Hash parsing considered ugly

drkjam drkjam at dsl.pipex.com
Sat Feb 25 22:27:54 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When I say :-

    use strict;
    use warnings;
    use Data::Dumper;

    my %h = (
        foo => 1,
        foo => 2,
    );

    print Dumper(\%h);

Perl provides :-

    $VAR1 = {
              'foo' => 2
            };

Assuming there is an awful lot more items in the hash than shown here
this could lead to unexpected results. Is there any way at all to get
Perl to flag this with at least some form of warning? It can lead to
some rather insidious bugs if you aren't paying attention.

Dave M.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEANnq4iT/h11w1zgRAuRxAJ0f+9CFtH6siVmSFcH0JZuAPlO3SQCglcgI
v2H9xz0OB0aT7T+0KYPCNm0=
=v7gf
-----END PGP SIGNATURE-----



More information about the london.pm mailing list