Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Trying like this:Can't use an undefined value as an ARRAY reference
Sample 2:my $data = data(); my $count = scalar(@$data); # $#$data; print $count;
Sample 3:It does not work if the array ref returns nothings my $data = data(); my $count = scalar(@$data); # $#$data; print $count;
my @count = $data; my $count = @count; print $count;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Count elements in array ref
by Your Mother (Archbishop) on Mar 29, 2016 at 18:10 UTC | |
by Anonymous Monk on Mar 29, 2016 at 18:27 UTC | |
|
Re: Count elements in array ref
by Corion (Patriarch) on Mar 29, 2016 at 18:01 UTC | |
|
Re: Count elements in array ref
by JohnCub (Beadle) on Mar 29, 2016 at 18:06 UTC | |
by AnomalousMonk (Archbishop) on Mar 29, 2016 at 19:29 UTC | |
by JohnCub (Beadle) on Mar 29, 2016 at 20:03 UTC | |
by AnomalousMonk (Archbishop) on Mar 29, 2016 at 20:41 UTC | |
|
Re: Count elements in array ref
by hippo (Archbishop) on Mar 30, 2016 at 09:16 UTC |