Tuesday, January 15, 2013
11:00 PM

Perl Script: How to use system defined Error message

There are many Perl defined system variables that you can use in your script, one of them is "$!", When used in a numeric context, holds the current value of errno. If used in a string context, will hold the error string associated with errno.

Below is simple Perl script which prints all available system error message and their corresponding error codes.


Source: error_message.pl

#!/usr/bin/perl
for ($! = 1, $i = 1; $! <= 25; $!++, $i++) {
    $errormsg = $!;
    chomp($errormsg);
    print "$i : $! \n";
}
Continue Reading...

0 comments:

Post a Comment