S
slash
hi,
i am new to perl and am trying to convert the code below into a
subroutine but have a problem concering the reading of the input.
i am trying to pass an array as an argument to the subroutine. the
array is produced earlier in the program and needs to be passed to the
subroutine. @array holds LINES of words separated by whitespace. so,
$array[0] will be one line from the DATA below. the code below runs
fine as a separate program but I don't know how to pass @array as an
argument to the function. could someone help me with this simple
problem? i hope i worded it clearly.
thanks,
slash
----CODE-----------
while (<>) {
@tmp=split;
push @AoA, [@tmp];
}
for $row(@AoA) {
push @$row, $ARGV;
print "@$row\n";
}
-----DATA------
regular expressions are used by
many programs such as the
UNIX commands grep sed awk
i am new to perl and am trying to convert the code below into a
subroutine but have a problem concering the reading of the input.
i am trying to pass an array as an argument to the subroutine. the
array is produced earlier in the program and needs to be passed to the
subroutine. @array holds LINES of words separated by whitespace. so,
$array[0] will be one line from the DATA below. the code below runs
fine as a separate program but I don't know how to pass @array as an
argument to the function. could someone help me with this simple
problem? i hope i worded it clearly.
thanks,
slash
----CODE-----------
while (<>) {
@tmp=split;
push @AoA, [@tmp];
}
for $row(@AoA) {
push @$row, $ARGV;
print "@$row\n";
}
-----DATA------
regular expressions are used by
many programs such as the
UNIX commands grep sed awk