perlop and perlretut seem not to mention that $1, $2 ... are reset
even when one doesn't use ()'s.
"Hello World" =~ /W(o)rld/;
print $1; #prints "o"
"Hello World" =~ /World/;
print $1; #uninitialized value!
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <[EMAIL PROTECTED]>, Dan Jacobson
<[EMAIL PROTECTED]> wrote:
> perlop and perlretut seem not to mention that $1, $2 ... are reset
> even when one doesn't use ()'s.
The memory va
>> perlop and perlretut seem not to mention that $1, $2 ... are reset
>> even when one doesn't use ()'s.
b> The memory variables are always the values from the last successful
b> match. It doesn't matter what that match was. See their entry in
b> perlre.
b> Which parts of perlop and perlreftut
gmane.comp.lang.perl.documentation is now on gmane.org, so you can
read this group by NNTP. Oh, you already can otherwise. Well, the more
the merrier. Over and out.
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <[EMAIL PROTECTED]>, Dan Jacobson
<[EMAIL PROTECTED]> wrote:
> >> perlop and perlretut seem not to mention that $1, $2 ... are reset
> >> even when one doesn't use ()'s.
>
> b>