On Dec 20, 2007 4:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
snip
> >> $ts = ($test =~ m{(.+)@$});
snip
> > '$' means end of a line,
>
> Obviously not in this case, since the regex returns 1 in scalar context
> (i.e. it matches).
snip

It is returning 1 because it is in scalar context, @$ is undefined
(making the regex /(.+)/), and there is at least one character in
$test.  With the proper quoting of @ the $ will in fact cause problems
for the OP.  Here is an interesting fact: the strict pragma will not
catch @$ even though it is not a variable defined in perldoc perlvar
and was not declared.  This is why the strict pragma should always be
paired with the warnings pragma (and vice versa).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to