Re: anonymous hash reference

2010-10-31 Thread Thorsten Scherf
bject: Re: anonymous hash reference >>>>> "JP" == Jeff Pang writes: JP> print check_for_exists('name','foo'); JP> sub check_for_exists { JP>my $key = shift; JP>my $value = shift; JP> for my $item (@$foo)

Re: anonymous hash reference

2010-10-31 Thread Uri Guttman
> "JP" == Jeff Pang writes: JP> print check_for_exists('name','foo'); JP> sub check_for_exists { JP>my $key = shift; JP>my $value = shift; JP> for my $item (@$foo) { JP> if ($item->{$key} eq $value ) { JP>return 1; JP> } JP> }

Re: anonymous hash reference

2010-10-31 Thread Jeff Pang
于 2010-10-31 21:43, Thorsten Scherf 写道: Hi, I have an array with anonymous hash references like the following: $foo = [ { name = value, id = value, }, { name = value, id = value, } ]; Iterating through the hash references works with: foreach $item (@$foo) { do something with $item->name; }

anonymous hash reference

2010-10-31 Thread Thorsten Scherf
Hi, I have an array with anonymous hash references like the following: $foo = [ { name = value, id = value, }, { name = value, id = value, } ]; Iterating through the hash references works with: foreach $item (@$foo) { do something with $item->name; } What