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/) {...} ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What's missing in Perl 5.10
by grinder (Bishop) on Dec 20, 2007 at 11:38 UTC | |
by Roy Johnson (Monsignor) on Dec 20, 2007 at 21:33 UTC | |
by blazar (Canon) on Dec 20, 2007 at 16:34 UTC | |
by moritz (Cardinal) on Dec 21, 2007 at 08:16 UTC | |
|
Re: What's missing in Perl 5.10
by educated_foo (Vicar) on Dec 20, 2007 at 00:50 UTC | |
|
Re: What's missing in Perl 5.10
by mugwumpjism (Hermit) on Dec 21, 2007 at 05:41 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |