Re: how to use hash as parameter

2005-01-31 Thread Ankur Gupta
#!/usr/bin/perl my %hs; $hs{"one"} = 1; $hs{"two"} = 2; sub pr { my $ref = $_; foreach $key (sort keys %$ref) { print "$key = ${$ref{$key}}"; } } pr(\%hs); This should work.. -- Ankur Hou Feng.Leo wrote: > Dear all, > I want to pass a hash to a function which prints out hash's content. > My

Re: how to use hash as parameter

2005-01-31 Thread Ing. Branislav Gerzo
Hou Feng.Leo [HFL], on Monday, January 31, 2005 at 11:00 (+) contributed this to our collective wisdom: HFL> I want to pass a hash to a function which prints out hash's content. My HFL> code does not work. Can anyone tell me what is wrong with it? Thanks a lot nearly everything you needs for

how to use hash as parameter

2005-01-31 Thread Hou Feng.Leo
Dear all, I want to pass a hash to a function which prints out hash's content. My code does not work. Can anyone tell me what is wrong with it? Thanks a lot #!/usr/bin/perl my %hs; $hs{"one"} = 1; $hs{"two"} = 2; sub pr { my $ref = $_; foreach $key (sort keys %ref) { print "$key = $r