Using a Module from the Standard Perl Library in a Script) : Module « Language Basics « Perl
- Perl
- Language Basics
- Module
Using a Module from the Standard Perl Library in a Script)
#!/bin/perl
use Carp qw(cluck);
print "Number: ";
$grade = <STDIN>;
try($grade); # Call subroutine
sub try{
my($number)=@_;
cluck "Illegal value: " if $number < 0 || $number > 100;
}
print "That was just a warning. Program continues here.\n";
Related examples in the same category