Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: no rows returned for dbi fetchall_arrayref

by Random_Walk (Parson)
on May 07, 2013 at 16:37 UTC ( #1032509=note: print w/ replies, xml ) Need Help??


in reply to no rows returned for dbi fetchall_arrayref

In one case you stringified it. In the other you are taking it in scalar context and Perl magic is not doing what you expect.

use strict; use warnings; use 5.010; my @array = qw (there is some data here); is_empty (\@array); # look out for edge cases @array = qw(one); is_empty(\@array); #empty it @array = (); is_empty (\@array); sub is_empty { my $array_ref = shift; say "\nGot: ". join ", ", @{$array_ref}; say "Empty" unless scalar @{$array_ref}; say "Caution" if $#{$array_ref} == 0; say "Empty" if $#{$array_ref} == -1; say "Maths == String?" if @{$array_ref} == ""; say "Empty as String?" if @{$array_ref} eq ""; }

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!


Comment on Re: no rows returned for dbi fetchall_arrayref
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032509]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-07-05 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls