On Tue, Jan 6, 2009 at 3:48 PM, Richard Hainsworth <rich...@rusrating.ru> wrote: > Suppose I want a 'when' clause to fire when the test is *not* met. What > syntax should be used? > > So how would I do > > my $x = 'abced'; > given $x { > when ! /<digit>/ {say 'this does not contain a digit'} # this does not work > } > > Since the ~~ operator is implied in the when, how do we get an implied !~~ > operator? > > By analogy with the > if/unless and while/until pairs, perhaps there should be an inverse for > 'when'. > > I cant think of an immediate opposite to 'when', but how about > although, yet, except, howbeit > > Perhaps (less elegant): when not, elided to 'whent' > > English doesnt seem to have a word that fits the opposite of > 'when' <condition> <do this> > In other words something that would substitute for > 'when the following is not true' <condition> <do this>
English has "unless", but Perl doesn't have it free there. -- Gaal Yahas <g...@forum2.org> http://gaal.livejournal.com/