http://qs1969.pair.com?node_id=180905

dimmesdale has asked for the wisdom of the Perl Monks concerning the following question:

I have a Tk callback where I give it as arguments an anonymous hash, like so:

$canvas->bind($dk_img, "<Button-1>", [\&frst_clk, { deck => $deck, waste => $waste, img => $dk_img }]);

Well, after some experimentation, I realized the placement of how I get at the arguments is VERY important (i.e., if I don't shift the first arg off--an implicit Tk object, in this case a canvas--getting at the other one is a mess).

However, even after this, I cannot seem to get at the other argument. I'm getting unitialized errors, so I 'Data::Dumped' it, resulting in this:

$VAR1 = { 'deck' => bless( { 'next' => 0, 'num' => 0, 'max' => 52, 'cards' => [ bless( { 'state' => 'up', 'where' => $VAR1->{ +'deck'}, 'value' => 'j', 'suit' => 's' }, 'Card' ), ...more blessed cards... bless( { 'state' => 'down', 'where' => $VAR1->{ +'deck'}, 'value' => 5, 'suit' => 'c' }, 'Card' ) ] }, 'Pile' ), 'img' => 12, 'waste' => bless( { 'next' => 0, 'num' => 0, 'max' => 52 }, 'Pile' ) };

Well, I know I have what I want, so its a tricky matter of dereferencing, or what not. I figured it was an anonymous array, so I tried:

$_->{deck} ## to no avail, so then I tried: $_{deck} ## then: ${@_{deck}} ## and a bunch of other big and baggy monsters ...

How do I get at the data?

(incidentally, this is the result of a rewrite of some code I posted before about a solitaire program, viewable on my sketch pad...soon)