Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Problem with string as HASH ref while strict refs in use

by f00li5h (Chaplain)
on Nov 07, 2008 at 00:36 UTC ( #722122=note: print w/replies, xml ) Need Help??

in reply to Problem with string as HASH ref while strict refs in use

you have something like

package Cats; sub new { bless {}, shift } # generic constructor ;) sub purring { $self = shift; $self->{key} = "foos" };

what's happening is that you are calling that method on the package, instead of on an instance of a class...

my $self = Cats->new; $self->pruring; # will set the key, since $_[0] is $self Cats->purring; # will treat the invocant ("Cats") as a hashref, since + $_[0] is the package name

perlboot has more. (and yes, It is deliberate that i didn't write it in terms of your code ;)

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://722122]
[1nickt]: chacham I have wanted to, and dones so, and so stated in a reply, and been roundly downvoted 2-1. (I assume for attempting to censor.)
[1nickt]: pryrt yes, I see. There is no way to differentiate without forcing to a string and all sort of weird stuff. It is enough. User 42 can get creative if s/he wishes.
[chacham]: i sent him a private message expressing my displeasure.
[1nickt]: chacham It was worse than 2-1 ! almost 4-1 !

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2017-05-24 20:50 GMT
Find Nodes?
    Voting Booth?