While messing with CGI POSTed data I got trapped by this one.

Version 5.8.1-RC3 for Mac OS 10.3.9

It appears that the hash element "D" gets defined in the process of testing to 
see if an element in the associated string is defined. The last if below takes 
the else route.

Is that normal? Does it somehow make sense?

%phash = ();
foreach $jill ("A", "B", "C")
    {
    for ($lynn = 0; $lynn<3; $lynn++)
        {
        $phash{$jill}[$lynn] = "$jill$lynn";
        print "\$phash{$jill}[$lynn] = $phash{$jill}[$lynn]\n";
        }
    }
if (! defined $phash{"D"})
    {
    print "\$phash{D} is undefined, We expected that.\n";
    }
if (! defined $phash{"D"}[3])
    {
    print "\$phash{D}[3] is undefined. We expected that too.\n";
    }
if (! defined $phash{"D"})
    {
    print "\$phash{D} is undefined\n";
    }
else
    {
    print "\$phash{D} got defined - why?\n";
    }
__END__

-- 

Applescript syntax is like English spelling:
Roughly, but not thoroughly, thought through.

Reply via email to