Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: deferencing an hash in a subroutine

by murugu (Curate)
on Aug 20, 2010 at 16:36 UTC ( #856317=note: print w/ replies, xml ) Need Help??


in reply to deferencing an hash in a subroutine

saintex, But in your code you are not using the reference at all. I think if you want to change the original values, Then pass by reference and change it.

#!/usr/bin/perl -w use strict; my %h = qw(a b c d); &test(\%h); while ( my ($key, $value) = each(%h) ){ print "Key\t $key Value\t $value\n"; } sub test { my $h = shift; $h->{a}= "k"; ..... Some Code ....... }

Regards,
Murugesan Kandasamy
use perl for(;;);


Comment on Re: deferencing an hash in a subroutine
Download Code
Replies are listed 'Best First'.
Re^2: deferencing an hash in a subroutine
by saintex (Scribe) on Aug 20, 2010 at 17:02 UTC
    ok, so I will simply do a call like this:
    &elabora_st ('prepare',\%q);

    Thank yoU!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2015-07-31 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls