Results 1 to 3 of 3
I have a problem with a hash reference.
...
my $GetMsgDesc = {};
...
my $Buffer = MQGET($HConn, $HobjIP, $GetMsgDesc, $GetMsgOpts, $BufferLength, $CompCode, $Reason);
print $GetMsgDesc, "\n";
...
which print ...
- 07-07-2009 #1Linux Newbie
- Join Date
- Dec 2008
- Location
- Luxembourg
- Posts
- 130
Perl : hash reference values
I have a problem with a hash reference.
...
my $GetMsgDesc = {};
...
my $Buffer = MQGET($HConn, $HobjIP, $GetMsgDesc, $GetMsgOpts, $BufferLength, $CompCode, $Reason);
print $GetMsgDesc, "\n";
...
which print 'HASH(0x36d560)'
My question : from here how to print keys and values stored in $GetMesgDesc ?
Thanks for help.
Bye,
Bruno
- 07-08-2009 #2
You have to dereference the hashref. You can do this in one of two ways:
1) To get the hash that is being referenced, you simply do %$GetMsgDesc
2) To get a value for a key in the hash that is being referenced, you do $GetMsgDesc->{$key}
I hope that helps.DISTRO=Arch
Registered Linux User #388732
- 07-09-2009 #3Linux Newbie
- Join Date
- Dec 2008
- Location
- Luxembourg
- Posts
- 130
Thanks Cabhan.
Indeed it helps.
Bye,
Bruno


Reply With Quote