Do you know where your variables are? | |
PerlMonks |
Re: fall through switch/case in perlby radiantmatrix (Parson) |
on Sep 07, 2004 at 15:08 UTC ( [id://389088]=note: print w/replies, xml ) | Need Help?? |
Your example problem is fairly simple, but for more complicated switch-like behavior,
It's way overkill for your particular problem, but for commplicated situations, @switch_foo can contain references to subs, making it quite powerful (if a little slow). In practice, however, if your algorithm needs a switch equivalent, you're better off re-thinking your algorithm. Update: fixed the code so that it works!
-- $me = rand($hacker{perl});
In Section
Seekers of Perl Wisdom
|
|