in reply to Re^3: Smart enough for Smart Match??? (was "Understanding ...Given/When" )
in thread Understanding the benefit of Given/When ...
use 5.010; use strict; use warnings; my @a=('abc',1); given (@a) { when (/abc/ ) { print '/abc/'."\n" ;continue} when ("abc" ) { print "abc\n" ;continue} #when (1 ) { print "#\n" ;continue} when (['abc',1]) { print "copy\n" ;continue} when (\@a ) { print "self\n" } } print "as it should be: ",@a~~/abc/;
OUTPUT
abc copy self as it should be 1
Cheers Rolf
PS: I have to go, too ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Smart enough for Smart Match??? (was "Understanding ...Given/When" )
by ikegami (Patriarch) on Mar 04, 2010 at 19:08 UTC | |
by ikegami (Patriarch) on Mar 04, 2010 at 19:17 UTC | |
by LanX (Saint) on Mar 04, 2010 at 23:05 UTC | |
by ikegami (Patriarch) on Mar 04, 2010 at 23:46 UTC |