On Sat Jan 24 00:01:33 2009, richardh wrote:
> $perl6
>  > $_ = 'abc'; m/(a)/ and say "matched $0"
> Use of uninitialized value
> matched
>  > $_ = 'abc'; $_ ~~ m/(a)/ and say "matched $0"
> matched a
>  > $_ = 'abc'; m/x/ and say "matched"
> matched
>  >
> 
> Not quite sure what is going on here.
> 
> I understood that a bare match should be against $_.
> 
> But no match was made in first code line with a bare match.
> In second code line, match is explicitly against $_ and the match occurs 
> as expected.
> 
> However, in first line, even though no match was made, m// returned true
> Also in third code line a bare match yielded a true result.
> 
> 

Slight improvement:

$ ./perl6 
> $_ = 'abc'; m/(a)/ and say "matched $0"
matched a
> $_ = 'abc'; $_ ~~ m/(a)/ and say "matched $0"
matched a
> $_ = 'abc'; m/x/ and say "matched"
_block174




-- 
Will "Coke" Coleda

Reply via email to