RosettaCodeData/Task/Conditional-structures/Perl/conditional-structures.pl
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

8 lines
291 B
Perl

use feature "switch";
given ($input) {
when (0) { print 'input == 0'; }
when ('coffee') { print 'input equal coffee'; }
when ([1..9]) { print 'input between 1 and 9'; }
when (/rats/) { print 'input matches rats'; }
default { do_fallback; }
}