Just returning to perl learning after a few years and I have a problem that searching the net is not helping me very much.
I am trying to pass an array back from a subroutine but I am losing the data along the way. Any help would be very much appreciated!! Here is the relevant bit of my code
if ($ff1) {my @a_ff1 = &GetRow("$ff1")}; sub GetRow { my ($set) = $_[0]; my $sth = $dbh->prepare("SELECT `filter_partnumber`,`filter_fram` +,`filter_fleetguard`,`filter_notes` FROM `filter_desc` WHERE `filter_ +id` = $set ") or die $DBI::errstr; $sth->execute() or die $DBI::errstr; my @ary = $sth->fetchrow_array(); $sth->finish; return @ary; }
The subroutine array (@ary) has the desired data if checked by printing before return. But it does not get assigned to @a_ff1 in the if statement.
In reply to Passing an array back from a subroutine by ramjamman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |