Re: [Openledger-developer] Perl Question
Brought to you by:
klavs
From: Ang T. C. <at...@ew...> - 2005-07-29 16:53:56
|
hi Thanks. i never though of that way! how silly. thanks a lot from Ang Tony Fraser wrote: >On Fri, 2005-07-29 at 04:21, Ang Tun CHek wrote: > > >>To all >>i have some problem with the perl code below: >> >>@items = $invoice->get_items(); >> >> >This looks like the get_items() method returns a LIST. > > > >>foreach $iv (@items){ >>map {print "$_ = $iv->{$_} \n"; } keys %$iv; >>print "\n\n"; >>} >> >> >>when i simplified the above code to: >> >>foreach $iv (@{$invoice->get_items()}){ >> >> >Here your treating the return of get_items() as an ARRAYREF. > > > >>map {print "$_ = $iv->{$_} \n"; } keys %$iv; >>print "\n\n"; >>} >> >> >> > >try: >foreach $iv ($invoice->get_items()) { > map { print "$_ = $iv->{$_} \n" } keys %$iv; > print "\n\n"; >} > > > |