For a start the horrible nested if/else if code in the for loop can be cleaned up by using elsif (which you actually use in the while loop!):
foreach (@data) { my %ipstn_s; my %ipstn_a; next if $_->{_status} eq 'STOP'; if ( $_->{_status} eq 'START' && $_->{_i_pstn_trunk} ) { my $i_pstn_si = extract( $_->{_i_pstn_circuit}, $_->{_i_pstn_t +runk} ); push @{ $ipstn_s{$i_pstn_si} }, $_; pushnow( \%ipstn_s ); } elsif ( $_->{_status} eq 'START' ) { my $e_pstn_se = extract( $_->{_e_pstn_circuit}, $_->{_e_pstn_t +runk} ); ... pushnow( \%ipstn_a ); } else { $ncounter++; } }
Note too that $counter has been removed - it should be identical with @data used in scalar context. Also the next is handled by an if modifier which removes another level of indentation.
In reply to Re: help on my overall program
by GrandFather
in thread help on my overall program
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |