Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: passing a hash ref in a sub

by Lotus1 (Vicar)
on Oct 31, 2018 at 15:46 UTC ( [id://1225004]=note: print w/replies, xml ) Need Help??


in reply to passing a hash ref in a sub

Good question. The others explained it well already but here is another hint. (You weren't actually passing a reference is why it didn't work.)

use strict; use warnings; my $data = {status=>"ok",'message-type'=>"member",'message-version'=>" +1.0.0"}; my $result_hr; ref($result_hr) ? print "ref($result_hr)\n" : print "\$result_hr is no +t a reference.\n" ; $result_hr = {}; ref($result_hr) ? print "ref($result_hr)\n" : print "\$result_hr is no +t a reference.\n" ; __DATA__ $result_hr is not a reference. ref(HASH(0x3ddb70))

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-29 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found