sub INFO
{
my ($company,$last,$first,$serial,$meter) = @_;
print "COMPANY: $company\n";
print "LAST: $last\n";
print "FIRST: $first\n";
print "SERIAL: $serial\n";
print "METER: $meter\n";
}
# you can call it like so:
&INFO($company,$last,$first,$serial,$meter);
Since all the variables have the same names, it seems kind
of silly to pass them explicitly, but this is good practice
to get into in the long run. Personally, i'd find a way to
utilize a hash (and subroutines that print are not very
portable, so return a string instead):
use strict;
use warnings;
my %hash = (
COMPANY => 'Acme',
LAST => 'Scott',
FIRST => 'Randolph',
SERIAL => 'number',
METER => 'maid',
);
print &INFO(%hash);
sub INFO {
my %params = @_;
my $output;
$output .= "$_ = $params{$_}\n" for keys %params;
return $output;
}
Tie::IxHash will keep your keys ordered, should
you need that.
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
|