Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: delete hash slice from a hashref wont return vals?

by hdb (Monsignor)
on Aug 21, 2013 at 14:37 UTC ( [id://1050360]=note: print w/replies, xml ) Need Help??


in reply to delete hash slice from a hashref wont return vals?

It works for me:

use strict; use warnings; my $cgi = { a => 1, b => 2 }; my @keys = keys %$cgi; my @vals = delete @$cgi{ @keys }; print "@vals\n";

prints "1 2"

Replies are listed 'Best First'.
Re^2: delete hash slice from a hashref wont return vals?
by misterperl (Pilgrim) on Aug 21, 2013 at 14:56 UTC
    Yes I got it to work in a small example too. I'm starting to think it has something to do with the fact that im revisiting the page and $cgi may be somehow getting altered in a way I'm not seeing.

    Thanks for the reply sir!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found