in reply to Re: Re: Re: Re: Re: MySQL / Perl Question
in thread MySQL / Perl Question

Actually, fetchrow_array returns a list not an array. It makes a big difference in this discussion. Consider the following code:
#!/usr/bin/perl -wT use strict; my @array = (42); my $array_count = @array; # array in scalar context my $list_count = (42); # list in scalar context my $sub_count = testsub(); # list or array???? print "Array in scalar context: $array_count\n", "List in scalar context: $list_count\n", "Subs rv in scalar context: $sub_count\n"; sub testsub { # does this return a list or an array???? return (42); } =OUTPUT Array in scalar context: 1 List in scalar context: 42 Subs rv in scalar context: 42
The array evaluates to its number of elements, but the list evaluates to its rightmost member - in this case 42. The return value from the subroutine is actually a list not an array, which explains why $sub_count == $list_count == 42.

-Blake