Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of rafael (2125)

Thursday February 13, 2003
07:39 AM

The treetops of a bad neighbourhood

[ #10560 ]
Have I already mentioned here how much I dislike pseudo-hashes ? From perlref (5.8.0), we read : you may use an array reference in some contexts that would normally require a hash reference. That means that if you have mistakenly used an array ref where a hash ref was expected, (especially in the middle of a large and complex data structure, that's funnier), this may silently go very wrong (as perl doesn't even warn you that you're using a pseudo-hash). In my case, this meant two hours hunting down a Out of memory! / Callback called exit error.

(I think Jarkko added a deprecation warning for pseudo-hashes in 5.8.1-to-be, but I'm not sure.)

-- Title of this journal entry by David King (Happy Apple)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • yes, indeed (Score:3, Informative)

    by jhi (318) <jhi@iki.fi> on 2003.02.13 9:12 (#16984) Homepage Journal

    kosh:/tmp/jhi/maint ; /p/bin/perl -wle '$a=[{foo=>1,bar=>2},"FOO","BAR"];print $a->{foo}'
    FOO
    kosh:/tmp/jhi/maint ; ./perl -wle '$a=[{foo=>1,bar=>2},"FOO","BAR"];print $a->{foo}'
    Pseudo-hashes are deprecated at -e line 1.
    FOO
    kosh:/tmp/jhi/maint ;


    It's the dereferencing of pseudo-hashes that triggers the warning.


  • ____________________________________________________________________________
    [ 17725] By: hv                                    on 2002/08/17  00:51:19
            Log: Subject: [PATCH] Remove pseudo-hashes (complete)
                 From: Michael G Schwern <schwern@pobox.com>
                 Date: Tue, 6 Aug 2002 13:05:10 -0700 (21: