Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > hash return fro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 11001 of 11065
Post > Topic >>

hash return from a sub

by flyzone@[EMAIL PROTECTED] (Flyzone) Apr 28, 2008 at 10:06 AM

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.




 5 Posts in Topic:
hash return from a sub
flyzone@[EMAIL PROTECTED]  2008-04-28 10:06:06 
RE: hash return from a sub
andrew.curry@[EMAIL PROTE  2008-04-29 00:03:01 
Re: hash return from a sub
rob.dixon@[EMAIL PROTECTE  2008-04-29 00:17:02 
Re: hash return from a sub
noreply@[EMAIL PROTECTED]  2008-04-29 01:18:00 
Re: hash return from a sub
flyzone@[EMAIL PROTECTED]  2008-04-29 02:02:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 0:24:55 CDT 2008.