I got the same result from your script. Why not return references to hashes
from your sub?

my ($h, $i) = makeh();
sub makeh
{
        my %that, %who;
        $that{eins} = "one";
        $that{zwei} = "two";
        $that{drei} = "three";
        $who{kris}  = "wolff";
        $who{alex}      = "seidel";
        return(\%that, \%who);
}

foreach(keys %$h)
{
        print "$_ - $$h{$_}\n";
}
print "\n";
foreach(keys %$i)
{
        print "$_ - $$i{$_}\n";
}

Regards

Steve

-----Original Message-----
From: Kristofer Wolff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 21, 2001 1:47 PM
To: perllist
Subject: look at this !!! amazing ! 


Hi all, I found out somthing that is really bad !

i have a sub routine thats return a hash:

---------------------------------
my %h = makeh();
sub makeh
{
        my %that;
        $that{eins} = "one";
        $that{zwei} = "two";
        $that{drei} = "three";
        return(%that);
}
--------------------------------

fine ! it works for me since more than a year in a application. Today I
change the script and add somthing that rewuires 2 hashes and i tryed this

--------------------------------
my (%h, %i) = makeh();
sub makeh
{
        my %that, %who;
        $that{eins} = "one";
        $that{zwei} = "two";
        $that{drei} = "three";
        $who{kris}  = "wolff";
        $who{alex}      = "seidel";
        return(%that, %who);
}
--------------------------------


but now, i have EVERYTHING in %h and nothing in %i !!!!
foreach(keys %h)
{
        print "$_ - $h{$_}\n";
}

will show:
eins - one
kris - wolff
zwei - two
drei - three
alex - seidel



IS THIS A BUG OR AM I WRONG ???????

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web


                Email Disclaimer

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee.  Access to this email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution 
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful.  When addressed to our clients any opinions or advice
contained in this email are subject to the terms and conditions expressed in 
the governing KPMG client engagement letter.
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to