Hi All,

I'm struggling to try and understand a difference in the way my script runs
in Perl 5.6/Jaguar and Perl 5.8.1/Panther.  Consider this example:

sub x {
    for my $iii (0 .. (scalar @_) - 1) {
        my $iiiRef = \$_[$iii];
        print STDOUT "xxxx $iii - $iiiRef - $$iiiRef\n";
    }
}
x(1,2,3,4,5, 'hello world', 1 + 20);

Under Jaguar/Perl 5.6, I get output like this:

[inez:~/Desktop] mall% perl xxx.pl
xxxx 0 - SCALAR(0xdb48) - 1
xxxx 1 - SCALAR(0xdb3c) - 2
xxxx 2 - SCALAR(0x12ab0) - 3
xxxx 3 - SCALAR(0x12abc) - 4
xxxx 4 - SCALAR(0x12ac8) - 5
xxxx 5 - SCALAR(0x12ae0) - hello world
xxxx 6 - SCALAR(0x12af8) - 21

Notice how the addresses are all different, as they should be.  When I run
the same script on my Panther/Perl 5.8.1 machine I get this:

fatmat:~/Desktop mall$ perl xxx.pl
xxxx 0 - SCALAR(0x801264) - 1
xxxx 1 - SCALAR(0x801264) - 2
xxxx 2 - SCALAR(0x801264) - 3
xxxx 3 - SCALAR(0x801264) - 4
xxxx 4 - SCALAR(0x801264) - 5
xxxx 5 - SCALAR(0x801264) - hello world
xxxx 6 - SCALAR(0x801264) - 21

Notice how the addresses are all the same!  How can they be the same?  More
importantly, how do I get Perl 5.8.1 to do the right thing?

Cheers
-Mark

---------------------------------------------------------------------
Mark Alldritt                         Late Night Software Ltd.
Phone: 250-380-1725                   333 Moss Street
FAX:   250-383-3204                   Victoria, B.C.
WEB:   http://www.latenightsw.com/    CANADA  V8V-4M9
AIM:   markalldritt

Reply via email to