There's more than one way to do things | |
PerlMonks |
Re: range comparison in givenby kcott (Archbishop) |
on Jul 11, 2013 at 07:53 UTC ( [id://1043640]=note: print w/replies, xml ) | Need Help?? |
G'day mrguy123, "Solved -thanks for the help. Am now trying to discover how "safe" using given/when is (as of Perl 5.18, given/when has been marked experimental and issues warnings because it may undergo major changes in a future version of Perl)" You can avoid the (experimental) given/when/.../default construct by using a (non-experimental) for/if/elsif/.../else construct. Here's an example for your specific range comparison:
There's lots of other ways to achieve this. Here's one using nested ternary operators:
See also perlsyn - Basic BLOCKs which has other alternatives. -- Ken
In Section
Seekers of Perl Wisdom
|
|