When you pass by value (eg
myroutine( %hash )), a copy is made of %hash before it gets to the script so that any changes you do on it will not be seen outside the scope of the subroutine. If you want to change the hash contents, you have to pass the hash by reference:
my %hash = ( foo => 'baz' );
print $hash{foo}.'\n';
myroutine( \%hash );
print $hash{foo}.'\n';
sub myroutine
{
my $hash_ref = shift;
$$hash_ref{foo}='bar';
}
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain