On Sat Dec 27 14:08:48 2008, publiustemp-perl6us...@yahoo.com wrote: > subset Letter of Str where { $_ =~ /^ <[a..z]> $/ }; > > my $first_letter = 'a'; > say $first_letter; > > my Letter $second_letter = 'a'; > say $second_letter; > > sub doit (Letter $letter) { > say $letter; > } > > doit('a'); > > That outputs (_block69 is the second 'say' and the 'Cannot assign' is > the sub call): > > a > _block69 > Cannot assign to readonly variable. >
That's a Perl 5-o. :-) You likely meant: subset Letter of Str where { $_ ~~ /^ <[a..z]> $/ }; Which does work. But there are two issues: * We should implement the =~ check to give you a useful message about this change. There's already a ticket for that one. * I think both cases should give the "cannot assign to readonly variable" warning because the $_ should be read-only inside that block. So to resolve this ticket we should do the second of these. Thanks, Jonathan