in reply to Re: Making program readable
in thread Making program readable

I replaced the my if-else loops with these.

my @del_user_error_count; foreach my $i (0..4) { if ($cdr_post_array[11] eq $del_user_errors[$i]) { $del_user_error_count[$i]++; last; } }

Its decreased 42 lines but its increasing the execution time. I see this through benchmark.

For if-else loop it gives

 the code took:52 wallclock secs

After replacing the code with foreach

 the code took:67 wallclock secs

Replies are listed 'Best First'.
Re^3: Making program readable
by karlgoethebier (Abbot) on Oct 09, 2015 at 20:43 UTC
    "...I see this through benchmark..."

    You might try Iterator::Simple:

    #!/usr/bin/env perl use strict; use warnings; # use feature qw (say); use Iterator::Simple qw(iter); my $iterator = iter( [ 1 .. 4 ] ); while ( defined( my $i = $iterator->() ) ) { # warp action goes here }

    See also Bleeding edge as well as Re^2: Useful number of childs revisited.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Re^3: Making program readable
by Anonymous Monk on Oct 07, 2015 at 01:43 UTC

    Its decreased 42 lines but its increasing the execution time. I see this through benchmark.

    Ignore it, its not important :)