in reply to Not a HASH reference using YAML

You are trying to treat something as a hash reference (i.e. doing this: ->{foobar}) but it's not a hash reference; it's some other kind of reference. (Given that the source of the data is YAML, I'd put my money on it being an array reference.)

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: Not a HASH reference using YAML
by Anonymous Monk on Aug 17, 2012 at 14:39 UTC
    How would you do it if it is an array reference? Thanks!

      Array refs use square brackets rather than curly braces; and numeric indices rather than strings. So something like ->[0].

      Of course, I haven't seen your data, so it's impossible for me to say at what point you need to do this.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'