On Jun 11, Ron Smith said:
Does Perl have the equivalent of a case statement or a switch statement. I'm trying to avoid a bunch of "if-then" statements. I'm seeing posts regarding "use switch", but I want to make sure it's not a deprecated practice. I'm using Perl -v 5.8.0.
The Switch.pm module isn't standard with Perl, but is a way to do it... ... but in your case, all you really need is a hash! my %day_of_week = ( mon => 0, tue => 1, wed => 2, thu => 3, fri => 4, sat => 5, sun => 6, ); $num = $day_of_week{$day}; -- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.perlmonk.org/ % have long ago been overpaid? http://www.perlmonks.org/ % -- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>