Hi,
I need to retrieve value from a hash variable, corresponding to the input. This is how the code goes..
print "Message ID:";
$input = <STDIN>;
for($i=0; $i< $total_msg; $i++){
if ($input == $msg{$i}{msg_id}) {
$msg_body = $msg{$i}{message_body};
last;
}
}
With the above code, instead of printing just one message body corresponding to the input message id, it gives me the body of all the messages stored in hash.
Could anyone please tell me how to fix the following code?
Thank you,
Priya.
I need to retrieve value from a hash variable, corresponding to the input. This is how the code goes..
print "Message ID:";
$input = <STDIN>;
for($i=0; $i< $total_msg; $i++){
if ($input == $msg{$i}{msg_id}) {
$msg_body = $msg{$i}{message_body};
last;
}
}
With the above code, instead of printing just one message body corresponding to the input message id, it gives me the body of all the messages stored in hash.
Could anyone please tell me how to fix the following code?
Thank you,
Priya.