in reply to Making program readable
I have no OO techniques to suggest, just write clearer code.
Don't repeat yourself so much. This :-
if ($intermediate_array[12] eq "GSM" && $intermediate_array[9] + eq "MSubmit") { $intermediate_MO_cnt++; } if ($intermediate_array[12] eq "GSM" && $intermediate_array[9] + eq "MSubmit" && $intermediate_array[7] eq "MsgAccepted") { $total_MO_success++; }
could be written as :-
if ($intermediate_array[12] eq "GSM" && $intermediate_array[9] eq +"MSubmit") { $intermediate_MO_cnt++; if ( $intermediate_array[7] eq "MsgAccepted") { $total_MO_success++; } }
It's clearer and easier to see what your intent was, and there are fewer places for bugs to hide.
Variable names like $del_user1_error , $del_user2_error, .. $del_userN_error are always a sign that you should have used any array and you're writing too much code. So instead you could do something like this :-
my @del_user_error_count; for my $i (0..4) { if ($cdr_post_array[11] eq $del_user_errors[$i]) { $del_user_error_count[$i]++; last; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Making program readable
by ravi45722 (Pilgrim) on Oct 06, 2015 at 10:47 UTC | |
by karlgoethebier (Abbot) on Oct 09, 2015 at 20:43 UTC | |
by Anonymous Monk on Oct 07, 2015 at 01:43 UTC | |
Re^2: Making program readable
by ravi45722 (Pilgrim) on Oct 06, 2015 at 09:18 UTC | |
by Anonymous Monk on Oct 07, 2015 at 01:50 UTC |
In Section
Seekers of Perl Wisdom