in reply to How would you rewrite this?
If the calls were supposed to follow a regular pattern (as opposed to the last two calls breaking the pattern), then this would be how I would phrase it:
On the other hand, if the last two calls are supposed to be exactly as in the OP (and do not follow a regular a pattern), then make an extra array or hash to provide the necessary values for the index into @objects and for the second arg to get_updates().if ( $result_ref{'agency_id'} != 0 ) { my $i = 0; for my $k (qw/agency_id advertiser campaign_id admin_contact_id te +ch_contact_id) { get_updates($objects[$i++], $k, $result_ref->{$k}) if (defined $result_ref->{$k}); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How would you rewrite this?
by ihb (Deacon) on Apr 27, 2005 at 01:37 UTC | |
|
Re^2: How would you rewrite this?
by jacques (Priest) on Apr 27, 2005 at 01:34 UTC |