People who dislike list slicing should avoid scripting languages, especially Perl.Really? Just because I find list slices to avoid using $1 ugly? What else? People who don't like goto should avoid Perl? People who don't like m?? should avoid Perl? People who don't like code without warnings or strict?
@X = ($x =~ /#/g)[1,3];Ain't working. Sure, for the given pattern, it works. Now, let's change the pattern a little, shall we:
So, @X is empty, yet the pattern matches.my $x = "1234"; my @X = ($x =~ /(#)?/)[1,3]; say scalar @X; # defined(@X) is deprecated say "Matched" if $x =~ /(#)?/; __END__ 0 Matched
It prints NO ... therefore, JavaFan, your assertions are FALSE and FALSE.When I say "it doesn't always work", a single example where it does work isn't a contradiction.
Note also that Marshall wasn't doing it your way anyway, he put the list slice in scalar context.
In reply to Re^5: Question on Regex grouping
by JavaFan
in thread Question on Regex grouping
by ajguitarmaniac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |