Re: Self-recognizing programs and regular expressions

2005-03-08 Thread Abigail
fruitless, it did lead to: my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/; $qr =~ s/$qr//g; print $qr, \n; But that's a far cry from what I wanted to find. Abigail pgpMQ4E8ejcxP.pgp Description: PGP signature

Re: Load-Bearing Warnings

2005-02-02 Thread Abigail
the only one. I'd prefer to put -- there instead. Abigail pgpapui2lkHEz.pgp Description: PGP signature

Re: merlyn smeared by Python Johnnies' description of Schwartzian transform

2003-07-16 Thread Abigail
{$_ - [0]} sort { ... } map {[$_ = ...]} @unsorted; Abigail

Re: merlyn smeared by Python Johnnies' description of Schwartzian transform

2003-07-16 Thread Abigail
On Wed, Jul 16, 2003 at 01:37:27PM +0200, A. Pagaltzis wrote: * Abigail [EMAIL PROTECTED] [2003-07-16 11:33]: Yes. GRT usually have the form: @sort = map { ... } sort map { ... } @unsorted; with often pack/unpack in the map blocks, while an ST

Re: my if?

2003-07-03 Thread Abigail
On Thu, Jul 03, 2003 at 05:51:00AM +0100, Pense, Joachim wrote: [ { my $staticvar; sub mysub {...} }versus sub mysub {static $staticvar;} ] Abigail and others point that the first version is more flexible than the second one, which is true. Reason: the first construct allows subs

Re: my if?

2003-07-02 Thread Abigail
. And even in languages that do, it isn't used that often. Not every Perl programmer nowadays came by the way of C. Not by a long shot. Abigail

Re: my if?

2003-07-02 Thread Abigail
with a 'static' declared variable inside a function. Abigail

Re: my if?

2003-07-02 Thread Abigail
On Wed, Jul 02, 2003 at 10:33:01AM +0100, Pense, Joachim wrote: Abigail wrote On Wed, Jul 02, 2003 at 07:58:03AM +0100, Pense, Joachim wrote: that is often recommended in the Perl community. I think it is easy to see which version looks elegant and which one kludgy

Re: my if?

2003-07-02 Thread Abigail
On Wed, Jul 02, 2003 at 11:09:54AM +0100, Pense, Joachim wrote: Abigail wrote | sub x { | static $vbl ; | ... | | { | my $vbl; | sub x { | ... | } | } IMO, not doubt the latter looks far

Re: my if?

2003-07-02 Thread Abigail
On Wed, Jul 02, 2003 at 01:02:12PM +0100, Pense, Joachim wrote: -Original Message- From: Abigail [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 1:51 PM To: Pense, Joachim Cc: [EMAIL PROTECTED] Subject: Re: my if? On Wed, Jul 02, 2003 at 11:09:54AM +0100

Re: Hidden state? Invisible closures?

2003-05-28 Thread Abigail
123456 123456 123456 reverse 0, 1, 2, 3, 4, 5 Modification of a read-only value attempted 0, 1, 2, 3, 4, 5 Modification of a read-only value attempted Abigail

Re: Fun with RegExps

2003-02-18 Thread Abigail
. (?=.*[-_]) # Contains a dash or an underscore. (?!.{15}) # Doesn't contain 15 characters. /xs; It's easy to add more requirements. Abigail

Re: Zip/Postal codes.

2003-01-02 Thread Abigail
[aA]{2})(\W|$)/ I think it's worth mentioning that, right or wrong, postcodes are often written without the space in the middle. Abigail didn't mention whether he wanted to just match the canonical form, or match any common form. I'll probably make it so that people can do things like

Re: sort numbers

2003-01-02 Thread Abigail
that [2 1 3 4 5] has an odd parity, while the parity of [1 2 3 4 5] is even. But if no operation can change the parity, there's no way of going from [2 1 3 4 5] to [1 2 3 4 5]. Abigail

Re: fun with regex

2002-12-12 Thread Abigail
you could it in a single regex. I answered the question - your remarks don't have much to do with it. Abigail

Re: fun with regex

2002-12-12 Thread Abigail
purposes, might I suggest: $sql =~ /(\s*)/ and $sql =~ s/^$1//mg; The question was how to do it in one regex; the original poster already knew how to do it with two regexes. Abigail

Re: fun with regex

2002-12-12 Thread Abigail
. On second thought, /^(\s*|)/ to avoid warnings. What kind of warning? Do you know of a string where /^(\s*)/ doesn't match? Perhaps a string without a beginning? Or that has -1 space at the beginning? Abigail

Re: fun with regex

2002-12-11 Thread Abigail
' Abigail

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Abigail
but doing something else, or inefficient. But I don't think any of them applies to this particular example. Bart, can you explain why this is bad style? Or is it just your personal preference? Abigail

Re: NPL Puzzler for 6 Oct

2002-10-14 Thread Abigail
and 2079 solutions use only additions and concatination. Abigail

Re: ~9M lines of data

2002-10-14 Thread Abigail
should read the data row by row, finding each CREATE TABLE statement, and displaying the next ~50 lines INCLUDING this line - do this recursively until end of file is reached. grep -A 50 'CREATE TABLE' file.sql Abigail

Re: Maybe-useful subroutine (BETTER!)

2002-07-02 Thread Abigail
be too embarrassed to give a talk. 3) I gave obfuscation talks (about Japhs) on YAPC::NA::2000 and YAPC::NA::2001. Abigail 1. Perhaps not- I like the style and I appreciate you passing it on to me. I'm always looking for more perlish idioms. Yours will take some study however. I

Re: Maybe-useful subroutine

2002-07-01 Thread Abigail
] .. $#{$_ [1]}, 0 .. $_ [0] - 1]] } Abigail

Re: Maybe-useful subroutine

2002-07-01 Thread Abigail
Rotate 15: A B C D E A Abigail

Re: Maybe-useful subroutine (BETTER!)

2002-07-01 Thread Abigail
E Rotate 6: B C D E A Rotate 7: C D E A B Rotate 8: D E A B C Rotate 9: E A B C D Rotate 10: A B C D E Rotate 11: B C D E A Rotate 12: C D E A B Rotate 13: D E A B C Rotate 14: E A B C D Rotate 15: A B C D E Abigail

Re: Whitespace and Blocks (was RE: Fisher-Yates shuffle)

2002-04-19 Thread abigail
1, 2 foo, 1, bar, 2 But '$href - %' and also '$href - %' are syntax errors. You can put a variable on the right side of an arrow, but not a literal string. Abigail

Re: A better way ?

2002-04-18 Thread abigail
if 'END' eq substr $vFlag, 1, 3; next if '[' eq substr $_, 0, 1; { local $ = |; no strict 'refs'; (ucfirst lc $1) - () if $vFlag =~ /^.(tags)/; } Abigail

Re: Whitespace and Blocks (was RE: Fisher-Yates shuffle)

2002-04-17 Thread abigail
ago, the, to quote Larry, It's not just C. It's also any language than I've programmed in. It's also a rather significant break from 14 years of perl. Abigail

Re: Whitespace and Blocks (was RE: Fisher-Yates shuffle)

2002-04-16 Thread abigail
a shortcut: my %scut = %some_nested_hash{very_long_descriptive_key}{another_key}{one}; if %scut.{last_key} { # Perl 6 hashref syntax. # do stuff } Having to *add* code isn't actually making a shortcut, is it? ;-) Abigail

Re: Fisher-Yates shuffle

2002-04-15 Thread abigail
On Fri, Apr 12, 2002 at 02:14:36PM -0700, Erik Steven Harrison wrote: -- On Fri, 12 Apr 2002 18:27:11 abigail wrote: On Fri, Apr 12, 2002 at 04:42:07PM +0100, Piers Cawley wrote: [EMAIL PROTECTED] writes: Why isn't if %foo {key} {print Hello 1} equivalent

Re: Fisher-Yates shuffle

2002-04-12 Thread abigail
5.8 certainly isn't marking 'for' as deprecated, so it won't disappear any sooner than 5.12. BTW, if Larry is going to rename 'for' to 'loop', then he plans to keep it around. Doesn't sound deprecated at all to me. Abigail

Re: Fisher-Yates shuffle

2002-04-12 Thread abigail
over an array. Abigail

Re: Fisher-Yates shuffle

2002-04-12 Thread abigail
edition. Section 3.4.2, Algorithm P, pp 145. Reading: Addison-Wesley, 1997. ISBN: 0-201-89684-2. =item [4] R. Salfi: ICOMPSTAT 1974. Vienna: 1974, pp 28 - 35. =back Abigail

Re: Fisher-Yates shuffle

2002-04-12 Thread abigail
then that will be treated as the 'then' block. If it's the end of file, or a nonblock, then it'll be a syntax error. Did the code show anything following it? No? Well, then assume it isn't there. ;-) Next time I'll show this to someone, I'll add a semicolon. Abigail

Re: First differing char in two strings

2002-04-11 Thread abigail
. Luckely, there's a 1-character length operator that is documented to first evaluate the left operand, then the right: , ($a^$b)=~/\0*/,$+[0] If you actually want to assign the result, you'd have to write it as: ($a^$b)=~/\0*/,$x=$+[0] Abigail

Re: First differing char in two strings

2002-04-11 Thread abigail
. $VAL = ($a^$b)=~/\0*/*$+[0]; $VAL = ($a^$b)=~/\0*/,$+[0]; Well, it can be dropped in, you just have to know how to drop it! ;-) ($a^$b)=~/\0*/,$VAL = $+[0]; Abigail

Re: Fisher-Yates shuffle

2002-04-09 Thread abigail
P, pp 145. Reading: Addison-Wesley, 1997. ISBN: 0-201-89684-2. [2] R. A. Fisher and F. Yates: IStatistical Tables. London, 1938. Example 12. Abigail

Re: Fisher-Yates shuffle

2002-04-05 Thread abigail
. No references, no return in a wierd place, no check for special cases. (Yes, I realize that it swaps element 0 with itself at the end - a fair price for the simplicity) Abigail

Re: Fisher-Yates shuffle

2002-04-04 Thread abigail
problems. Abigail

Re: Why bother with separate lists?

2002-03-19 Thread abigail
wasn't following so I killed the thread and I don't even know [or care] how much longer it went on..]. Now, if I could place filters at my ISP, I'm all for it. But since that's out of the question, I don't go for the tune out reasoning. Abigail

Re: Why bother with separate lists?

2002-03-19 Thread abigail
, for everything. Abigail

Re: regex for html img... tags

2002-03-19 Thread abigail
because a bunch of people in Alaska do that in winter. Abigail

Re: regex for html img... tags

2002-03-19 Thread abigail
always said, and I keep on saying so, that Perl is not suited for most people calling themselves programmer. Having said that, I really enjoyed Abigail's presentation a few years back at YAPC. Thanks. Abigail

Re: Non-golf fun

2002-03-18 Thread abigail
. The relevant part of said program follows. Abigail my $ENVIRONMENT = /some/file/somewhere; if (@ARGV $ARGV [0] eq '--sourced_environment') { shift; } else { if (-f $ENVIRONMENT) { # # Now we perform a double exec. The first exec gives us a shell, # allowing us

Re: regex for html img... tags

2002-03-17 Thread abigail
of the perl FAQ addressing this question did you fail to understand? Abigail

Re: longest common substring (return of)

2002-03-13 Thread abigail
restriction. Abigail

Re: Sort is lazy?!? (as in Haskell)

2002-03-10 Thread abigail
in highest) { stick in highest, removing lowest in highest; } } return sort highest The Big Oh of that is n. No, it's not. It's O (n log X). Abigail

Re: More Wacky Solutions

2002-01-31 Thread abigail
the desired ratio. Or, by using comments and strings, ratios as close to 1 as wanted can be archieved. Abigail

Re: A perverse use of the glob function

2002-01-30 Thread abigail
${\context}\n; __END__ LIST This makes the ${\(EXPR)} not very useful; one could as well use @{[EXPR]} - which not only saves a keystroke, but is more symmetric. Abigail

Re: A perverse use of the glob function

2002-01-30 Thread abigail
} (as in your example) is still shorter than @{[foo]} (agreed however that the latter looks nicer). Yeah, but \ has quite a high priority. Higher than most binary operators. Most expressions you'd need to parenthesize. Abigail

Re: Better ?

2002-01-28 Thread abigail
their claim with any evidence. Cargo-cult programming is bad, but making cargo-cult claims is as bad. Abigail

Re: match URI and nothing more?

2002-01-21 Thread abigail
) Here's a start. It finds URIs for http, ftp, news, nttp, telnet, gopher, wais, mailto, file, prospero, ldap (sort of), z39_50, cid, mid, vemmi, imap and nfs. Not what you'd call complete. You'd have to remove the newlines. ;-) Abigail (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z

Re: ^=~

2002-01-21 Thread abigail
^=~, the ^ prefix can be used for most, if not all, operators. @c = @a ^+ @b; is far clearer than the map equivalent. Abigail

Re: ^=~

2002-01-21 Thread abigail
On Sun, Jan 20, 2002 at 11:31:25AM -0600, Matthew Wickline wrote: (well, it /is/ winking at me!) why not call it a wink? ... or maybe a flirt? I was thinking of something like winking Siamese (^=^ being a Siamese cat). Abigail

Re: Regex puzzle

2002-01-21 Thread abigail
].*$)| (?:^([\x00-\xfd].*)\xfe.*\508$)| (?:^(.*)\xff.*\509[\x00-\xfe].*$)| (?:^([\x00-\xfe].*)\xff.*\510$)/sx We could factor out the ^ and $ and save a few bytes in the resulting regex, but that's left as an exercise to the reader. Abigail

Re: Regex puzzle

2002-01-21 Thread abigail
Abigail

Re: ^=~

2002-01-21 Thread abigail
in both %b and %c (which would mean $a {$k} equals $c {$k}), we're adding the value of $b {$k}. This results in $a {$k} == $b {$k} + $c {$k}. For all keys that are in either %b or %c, but not both, %a will get the key with the corresponding value. Abigail

Re: ^=~

2002-01-21 Thread abigail
will be filled in by Perl, with an appropriate value, typically undef (which would become 0 in numerical context). Abigail

Re: Regex puzzle

2002-01-21 Thread abigail
+= 2; } my $regex = join |\n = map {(?:$_)} @strings; $regex = ^(?:$regex)\$; print /$regex/sx\n; __END__ Abigail

Re: test a password string for correctness

2001-12-17 Thread abigail
. While abc1234 is a correct password, if doesn't match y/A-Za-z// y/0-9//. Abigail

Re: PGA (Perl Golfers' Association)

2001-12-05 Thread abigail
be shortened to 'y===c' (which was dubbed Abigail's length horror by Larry Rosler). So, if you want to combine golf with obscurity, write it as: 50yc Abigail

Re: tri-state flags

2001-12-05 Thread abigail
between 0 and the empty string. do {no warnings; not local $_ = $flag and length}; Abigail

Re: The Santa Claus Golf Apocalypse

2001-12-05 Thread abigail
};print' Abigail

Re: tri-state flags

2001-12-05 Thread abigail
. Abigail

Re: middle line (was Re: Daily Perl FAQ...)

2001-12-03 Thread abigail
function. (A function cannot be both little-oh and little-omega of another function - hence there's no little-theta.) There's also Big-Lambda and little-lambda. Abigail

Re: World's First JAPH

2001-08-22 Thread Abigail
and J::j perl -MJ for suitable values of J.pm and J::import perl for suitable values of PERL5OPT p for suitable values of p And nothing at all for suitable values of /var/spool/cron/crontabs/root. Abigail

Re: World's First JAPH

2001-08-22 Thread Abigail
On Wed, Aug 22, 2001 at 06:46:43PM -0400, Keith C. Ivey wrote: Abigail [EMAIL PROTECTED] wrote: Being the one who has given several talks about Japhs, I've decreed that a Japh uses the following rules: - It prints Just another Perl Hacker with some reasonable captalization

Re: Sorting in-place

2001-07-31 Thread Abigail
years) If clashes with iteration is the worst thing that can happen if you share hashes between different modules by different authors, I will change my mind about the usefulness of lexical variables. Abigail

Re: Classic golf game revisited

2001-07-31 Thread Abigail
..9;keys%$x910==ycprint' words Abigail

Re: Sorting in-place

2001-07-31 Thread Abigail
On Wed, Aug 01, 2001 at 12:39:50AM +0200, Bart Lateur wrote: On Wed, 1 Aug 2001 00:24:50 +0200, Abigail wrote: There's more than one block in do {{EXPR; last}}. Argh! Pretty obfuscated, that is. Straigth from perlsyn. Abigail

Re: Sorting in-place

2001-07-31 Thread Abigail
On Wed, Aug 01, 2001 at 02:44:12AM +0200, Marc A. Lehmann wrote: On Wed, Aug 01, 2001 at 02:13:53AM +0200, Abigail [EMAIL PROTECTED] wrote: Minor and irrelevant details. The principle, a nest of a bare block and a compound block to be able to use loop control is straight from perlsyn.pod

Re: Sorting in-place

2001-07-26 Thread Abigail
that. Abigail

Re: Sorting in-place (SOLVED? No, further mysteries!)

2001-07-26 Thread Abigail
(be them increasing or decreasing) are determined. If you would then swap pairs, Perl will think the entire array is already monotonic - and you will have a sort that runs in linear time! Abigail

Re: Sorting in-place (SOLVED? No, further mysteries!)

2001-07-26 Thread Abigail
strings in O (N) time) Abigail

Re: End of block actions WITHOUT magic lexicals?

2001-07-23 Thread Abigail
; $count ++; print $result ? ok : not ok , $count, $trailer, \n; } ok (...); FOO: { local $trailer = # TODO; ok (...); } ok (...); Abigail

Re: End of block actions WITHOUT magic lexicals?

2001-07-23 Thread Abigail
TODO feature, he must obey the rules. schwern didn't agree. later this week i will clobber him with a blunt contract and we shall see if he won't change his mind. :) Here. All the magic in a package, with the user only having to make a TODO: {} block. package Abigail; use strict