This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: [sf-perl] silly question: slice of a hash ref From: "Matthew D. P. K. Strelchun-Lanier" <matt@lanier.org> Date: Thu, 13 Jul 2000 13:11:25 -0700 (PDT) i can't, for the life of me, figure out how to take a slice of a hash ref. any clues? === Subject: [sf-perl] followup: answer to hashref question From: "Matthew D. P. K. Strelchun-Lanier" <matt@lanier.org> Date: Thu, 13 Jul 2000 13:52:54 -0700 (PDT) i got 2 replies, both of which work. given: $x = { foo => 'bar', blitz => 'blat' }; both these work: 1) @{ $x }{'foo', 'blitz'} 2) map $x->{$_}, qw (foo blitz) any thoughts as to why the following doesn't? $x->{'foo', 'blitz'} ? === Subject: Re: [sf-perl] silly question: slice of a hash ref From: michael salmon <ms@papermedia.com> Date: Thu, 13 Jul 2000 13:46:16 -0700 it matters exactly what you mean.. ill take the two ways i guess you might be using. %a={'x'=>(1,2,3,4,5)} and you want 2..4 you can do @{ $a{x} }[2..4] if its a reference of %a, say $z=\%a; then you'd use @{ %$z->{x} }[2..4] ===