msemtd has asked for the wisdom of the Perl Monks concerning the following question:
...but this gives me $1 = aa, $2 = bb, $3 = cc...$_ = "aaaabbbbcccc"; if ( not /^(\w\w)(\w\w)(\w\w)$/ ) { if ( not /^(\w\w)\w\w(\w\w)\w\w(\w\w)\w\w$/ ) { die "failed"; } } print "$_ = $1 $2 $3\n";
...as I would have expected from the first snippet. Am I just being thick?$_ = "aaaabbbbcccc"; if ( not /^(\w\w)\w\w(\w\w)\w\w(\w\w)\w\w$/ ) { die "failed"; } print "$_ = $1 $2 $3\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capture vars undef
by ccn (Vicar) on Jul 27, 2004 at 14:13 UTC | |
|
Re: capture vars undef
by deibyz (Hermit) on Jul 27, 2004 at 14:15 UTC | |
|
Re: capture vars undef
by msemtd (Scribe) on Jul 27, 2004 at 14:21 UTC | |
by fletcher_the_dog (Friar) on Jul 27, 2004 at 17:03 UTC | |
by Chady (Priest) on Jul 28, 2004 at 06:20 UTC |