http://qs321.pair.com?node_id=1078454


in reply to Given When Syntax

I'm mobile and can't spot or test your problem.

Normally I recommend replacing given/when with for/if-constructs.

But in this particular case I don't understand why you are not simply using an array or a hash, holding the number's names.

Cheers Rolf

( addicted to the Perl Programming Language)

edit

Ehm... did you activate switch?

 use feature "switch"; or use 5.010;

update

DB<103> @num=qw/Zero One Two Three Four/ => ("Zero", "One", "Two", "Three", "Four") DB<104> $var=2; print "$var is $num[$var]"; => 1 2 is Two