rastoboy has asked for the wisdom of the Perl Monks concerning the following question:
and thenif ($content->{Addresses}{ArrayOfAddressResponse}{AddressResponse} =~ +/HASH/) { foreach my $response ( keys %{$content->{Addresses}{ArrayOfAddressResp +onse}} ) { ...do stuff...
The thing is, the "stuff" I'm doing ends up looking identical like:if ( $content->{Addresses}{ArrayOfAddressResponse}{AddressResponse} =~ + /ARRAY/) { foreach my $response ( @ {$content->{Addresses}{ArrayOfAddressResponse +}{AddressResponse}} ) {
So it just seems very wasteful. I've thought about just making all the print statements a subroutine. But it's the two "if" statements that seem kinda clunky to me. Any input would be greatly appreciated (again)!print "street: $response->{Street}<br>"; print "street2: $response>{Street2}<br>"; print "apt: $response->{UnitNumber}<br>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing a loop based on the nature of a reference
by Your Mother (Archbishop) on Nov 05, 2009 at 05:41 UTC | |
|
Re: Changing a loop based on the nature of a reference
by colwellj (Monk) on Nov 05, 2009 at 05:49 UTC | |
by rastoboy (Monk) on Nov 05, 2009 at 07:47 UTC |