in reply to Re: zlib error
in thread zlib error

so perl fails when it tries to dereference the string

Interestingly, the code

my $package = "Compress::Zlib::"; print "$package defined\n" if defined %$package;

works fine with 5.8.8 (with strictures enabled), while 5.10.1 complains as shown in the OP...

Update: and with 5.12.0 you get

defined(%hash) is deprecated at ./835534.pl line 10. (Maybe you should just omit the defined()?)

...which also does work fine (with strictures) when you do so, i.e. when you write ... if %$package;  nonsense (I had forgotten to comment out the no strict 'refs', which I had added in the meantime...) — in other words, for both 5.10 and 5.12 (but not 5.8) you do need the no strict 'refs', even without the deprecated defined %...

Replies are listed 'Best First'.
Re^3: zlib error
by ikegami (Patriarch) on Apr 19, 2010 at 17:18 UTC

    which also does work fine (with strictures)

    Not for me.

    $ perl -v This is perl 5, version 12, subversion 0 (v5.12.0) built for i686-linu +x [snip] $ perl -Mstrict -wle'my $pkg="Foo::"; print(defined(%$pkg)?1:0)' defined(%hash) is deprecated at -e line 1. (Maybe you should just omit the defined()?) Can't use string ("Foo::") as a HASH ref while "strict refs" in use at + -e line 1.

    Update: Oops, seems you noticed your mistake while I was posting.