Front page | perl.beginners |
Postings from April 2008
hash return from a sub
Thread Next
From:
Flyzone
Date:
April 28, 2008 15:57
Subject:
hash return from a sub
How can i return a copy of the hash? (The hash is build correct, but
return alsways null)
Here a sample of my code:
sub mysub {
while (.....) {
var1 = ....;
var2 = ....;
$myhash{$var1} = $var2;
}
print %myhash; # all ok until here
return ( %myhash );
}
%test=mysub();
print %test; # wrong, don't print nothing, neither error;
I would like to return a copy of the hash to a new variable, not a
reference.
Thanks in advance.
Thread Next
-
hash return from a sub
by Flyzone