[Omaha.pm] What's that structure name?

Jay Hannah jay at jays.net
Tue Sep 2 10:06:00 PDT 2008


On Sep 1, 2008, at 8:33 PM, Dave Thacker wrote:
> while (my ($name, $age, $st, $tk, $ps, $sh ) = $sth->fetchrow_array 
> () ) {
>         print "$name, $age, $st, $tk, $ps, $sh \n";
>     }
>
> How do I refer to that array if I want to send it into a sub?  Or  
> do I need to
> assign it to an array of my own.....

You don't have an array there, you just have a list. You can create  
an array called @row if you want, and pass that to your sub:

while (my @row = $sth->fetchrow_array()) {
    my_sub(@row);
}

sub my_sub {
    my (@row) = @_;
    print join ", ", @row;
    print "\n";
}

HTH,

j




More information about the Omaha-pm mailing list