Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

Re: array references in DBI

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

in reply to array references in DBI

I just read the Adv Perl Prog 1st edition and so am trying to use references more. Conceptually it seems straight-forward, but in practice can be a little tricky. So in the same vain, I'm wondering why I can't seem to do:

$temp = pop @$arrayref


Replies are listed 'Best First'.
Re^2: array references in DBI
by CountZero (Bishop) on May 13, 2006 at 18:04 UTC
    It works as expected on my computer (Activestate Perl 5.8.7)
    # perl v5.8.7 [MSWin32-x86-multi-thread] > my @array= qw/een twee drie vier/; > my $arrayref = \@array; > print $arrayref; ARRAY(0x2089584) > pop @$arrayref; vier > my $temp = pop @$arrayref; > print $temp; drie


    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Sorry, I should have been much more specific, as it's probably also my confusion as to how DBI works. If I do something like:

      my $ratest = $dbh->selectrow_arrayref($sql); my $testorder = pop @$ratest;

      I get an error: Modification of a read-only value attempted

        Did selectrow_arrayref() actually return an array ref? If the $sql failed, $ratest will be 0 (a literal).

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-06-15 20:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.