Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: Returning hash reference from a sub

by tobias_hofer (Friar)
on Mar 18, 2013 at 14:13 UTC ( #1024057=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Returning hash reference from a sub
in thread Returning hash reference from a sub

Hi, this won't work as you use the same keys.

$VAR1 = { 'names' => 'mary', 'names' => 'john', 'names' => 'Doe', 'names => '' };
Better try to make an array of hashes which would look like this:
$VAR1 = [ { 'names' => 'mary'}, { 'names' => 'john'}, { 'names' => 'Doe'}, { 'names => ''} ];
or
$VAR1 = { 'names' => ['mary','john','Doe','']}; ];


Comment on Re^5: Returning hash reference from a sub
Select or Download Code
Re^6: Returning hash reference from a sub
by Anonymous Monk on Mar 18, 2013 at 14:29 UTC
    I know, wish it could be return as:
    $VAR1 = { 'names' => 'mary'}, { 'names' => 'john'}, { 'names' => 'Doe'}, { 'names => ''} ;
    }, {

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-07-12 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (241 votes), past polls