in reply to Re^2: Understanding the benefit of Given/When ...
in thread Understanding the benefit of Given/When ...
my @test = qw[abc def ghi xyz]; my @res; for (@test) { when (/abc/) {push @res, "abc"; continue} when (/def/) {push @res, "def"; last} when (/xyz/) {push @res, "xyz"; next} default {push @res, "default"} } continue { print "FOR/CONT($_): @res\n"; @res = (); } __END__ FOR/CONT(abc): abc default
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Understanding the benefit of Given/When ...
by LanX (Saint) on Mar 04, 2010 at 16:42 UTC | |
by JavaFan (Canon) on Mar 04, 2010 at 16:56 UTC | |
by LanX (Saint) on Mar 04, 2010 at 17:12 UTC | |
by JavaFan (Canon) on Mar 04, 2010 at 17:27 UTC | |
by LanX (Saint) on Mar 04, 2010 at 17:41 UTC | |
|