programming-examples/perl/Statement/Switch on sub.pl

14 lines
292 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
use strict;
use Switch;
my $input;
sub lessthan { $input < $_[0] };
$input=int(<>);
switch ( \&lessthan ) {
case 10 { print "less than 10\n" }
case (100-$input) { print "less than 50\n" }
case 100 { print "less than 100\n" }
}