phi95aly has asked for the wisdom of the Perl Monks concerning the following question:
i have a situation where i get hash ref $result from somebody else's module and need to access certain slices. however, the name of the slices are inconsistent because they include a length index: for instance the slice TEST could be named TEST[1] or TEST[3] etc...
i'm trying to access this in the following way: $result->{'TEST[1]'} etc... but, of course this isnt working if it's named TEST[2]. is there a better way to do this, so it will grab TEST no matter what the length index is?just for your info, the serialized structure (Data::Dumper) of one result set looks like this:
$VAR1 = { 'TEST[2]' => '24', 'RESPMSG[42]' => 'invalid or empty account expirJanitored by Arunbear - balanced code tag and retitled from 'refernce acess with inconsitent names'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing a hash with inconsistent key names
by ikegami (Patriarch) on Oct 25, 2004 at 23:05 UTC | |
|
Re: Accessing a hash with inconsistent key names
by Zaxo (Archbishop) on Oct 25, 2004 at 23:12 UTC | |
|
Re: Accessing a hash with inconsistent key names
by borisz (Canon) on Oct 25, 2004 at 23:55 UTC |