Looks to me like the first candidate is a !~~ operator (or maybe a change to the behaviour table of ~~). Due to all the magic in the ~~ operator, $a !~~ $b is (well would not be) not the same thing as !($a ~~ $b). Let's have a look at what does the ~~ mean in case $a is an array and $b is a regexp:
What does that mean? Is it true if ANY of the elements in the array match the regexp or if ALL match? According to the docs @ARRAY ~~ $regexp is equivalent to grep /$regexp/, @ARRAY. Which means that statement above is true if ANY of the parameters matches the regexp (ends with .mdb).@ARGV ~~ /\.mdb$/i
Ok, but how do I make sure all are? How do we rewrite:
with the cool new ~~ ifif (grep { not /\.mdb$/i } @ARGV) { print STDERR "All parameters must be MDB files\n"; exit; }
doesn't cut it? And@ARGV ~~ /\.mdb\z/ or die "All parameters must be MDB files"
according to the docs doesn't work? (According to the docs @ARRAY ~~ $sub is $sub->(@ARRAY) not grep {$sub->($_)} @ARRAY)@ARGV ~~ sub {$_[0] !~ /\.mdb$/i} and die "All parameters must be MDB files"
With !~~ it would be easy:
@ARGV !~~ /\.mdb$/i and die "All parameters must be MDB files";
And
or maybegiven($foo) { when (! /some regexp/) {...} ... }
would also come in handy.given($foo) { when ! (/some regexp/) {...} ... }
In reply to What's missing in Perl 5.10 by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |