Hello,
I am trying to pass an array by reference since it could become very large. The function should take the array and print it out but only 10 elements per line.
#!/usr/bin/perl -w
use strict; use warnings;
use DBI;
......
sub printlist {
my $arrayref = @_; my $max = $arrayref; my $nmax; for(my $i = 0; $i <= $max; $i++) { print "\t\t\t\t\t";
if ( ($max - $i) >= 10 ) { $nmax = 10; } else { $nmax = $max - $i; }
for(my $n = 0; $n <= $nmax; $n++) { print "$arrayref->[$i]\t"; # line 209 $n++; $i++; } print "\n"; }
}
......
&printlist([EMAIL PROTECTED]);
But I am receiving the following error:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at ./mysql-watch.pl line 209.
Does anybody know why ?
Thanks
Michael
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>