#!/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
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
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