Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 musing on the Monastery: (11)
As of 2014-09-22 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls