in reply to Understanding the benefit of Given/When ...
The when has an automatically built in smart match ~~. Nice ...but how can I take profit from this smart match if the parameter passed into given can only be a scalar?
Maybe, but you can check that scalar against a variety of things, not all of them scalars.
use 5.010; use strict; use warnings; my @x = qw( abc def ); given ("abc") { when (@x) { print "when\n"; } default { print "default\n"; } }
I have no idea what you are asking.
|
---|
Replies are listed 'Best First'. | |
---|---|
Smart enough for Smart Match??? (was "Understanding ...Given/When" )
by LanX (Saint) on Mar 04, 2010 at 15:53 UTC | |
by ikegami (Patriarch) on Mar 04, 2010 at 17:45 UTC | |
by LanX (Saint) on Mar 04, 2010 at 17:53 UTC | |
by ikegami (Patriarch) on Mar 04, 2010 at 18:04 UTC | |
by LanX (Saint) on Mar 04, 2010 at 18:10 UTC | |
|
In Section
Seekers of Perl Wisdom