ramjamman has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing an array back from a subroutine
by kennethk (Abbot) on Aug 02, 2010 at 21:06 UTC | |
|
Re: Passing an array back from a subroutine
by toolic (Bishop) on Aug 02, 2010 at 21:10 UTC | |
|
Re: Passing an array back from a subroutine
by pemungkah (Priest) on Aug 02, 2010 at 21:10 UTC | |
|
Re: Passing an array back from a subroutine
by ahmad (Hermit) on Aug 02, 2010 at 21:07 UTC | |
|
Re: Passing an array back from a subroutine
by ramjamman (Sexton) on Aug 02, 2010 at 21:45 UTC | |
by locked_user rnbacademy (Initiate) on Aug 03, 2010 at 00:59 UTC | |
|
Re: Passing an array back from a subroutine
by Generoso (Prior) on Aug 03, 2010 at 17:00 UTC |