Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: array references in DBI

by BrianC (Acolyte)
on May 13, 2006 at 16:14 UTC ( [id://549247]=note: print w/replies, xml ) Need Help??

in reply to Re: array references in DBI
in thread array references in DBI

Thank you for pointing this out. What if @an was lexical but declared before the while loop? I would have the same problem, no?

Replies are listed 'Best First'.
Re^3: array references in DBI
by bart (Canon) on May 15, 2006 at 11:35 UTC
    Yes, you would be pushing the same array ref every time, and the contents would change afterwards.

    Test code (no DBI involved):

    my @rows; my @row = qw(one two); push @rows, \@row; @row = qw(three four); use Data::Dumper; print Dumper \@rows; __END__ $VAR1 = [ [ 'three', 'four' ] ];

    As you can see, the contents of the collating array changes after you put it in there.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-05-29 20:58 GMT
Find Nodes?
    Voting Booth?

    No recent polls found