Im trying to figure how to send the value in $opt{p} and a straight string to the subroutine rather than an array.
use Getopt::Std;
my $opt_string = 'hdp:j:';
getopts( "$opt_string", \%opt ) or usage();
usage() if $opt{h};
}
sub usage()
{
print STDERR << "EOF";
This program grabs the problem print request and puts them in folder for investigation.
usage: $0 [-d] [-p printer] [-j job] -h : this (help) message
-p printer: problem printer
-j file : problem print job id
-d : print debugging messages to stderr
example: $0 -p PRINTERQ -j 76063 -d
EOF
exit;
}
sub find_printer
{
my $printer = $_[0] ;
print "Looking for printer $printer .. \n";
}
find_printer( $opt{p} ) or die "Unable to find printer";
The subroutine always receives an array – even if that contains a single parameter