baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
I have a mental blockade and i need to do this in the next hour. I need to rewrite this in a more simpler form but however i substitute the variables i get the same number of lines being executed:
so there are 3 conditions which are very similar in fact the first two are the same with opposite variables.if($l<$k){ if($s_rev[$d+1]==0 && $k-2>0){ $s_rev[$d+1] = $k-2; } $h=$s[$b] == 0 ? 0 : $s[$b]-1; $s[$b1] = max($k,$lt); $c=2; $j++; } elsif($l>$k){ if($s[$b+1]==0 && $l-2>0){ $s[$b+1] = $l-2; } $h=$s[$b] == 0 ? 0 : $s[$b]-1; $s[$b1] =max($l,$kt); $c=1; $i++; } else{ if($s[$b+1]==0 && $k-2>0){ $s[$b+1] = $k-2; } $s[$b1] = max($k,$lt); $h=0; $c=0; } sub max{ }
Thank you !
Update: all variables are numbers or number arrays. moreover, they are integers. So this is a procedure that a nee to write down as pseudo code with as less executable lines as possible
thank for the reply ww
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reducing the number of lines
by choroba (Cardinal) on Jan 11, 2013 at 16:59 UTC | |
|
Re: reducing the number of lines
by ww (Archbishop) on Jan 11, 2013 at 16:22 UTC | |
|
Re: reducing the number of lines
by tobyink (Canon) on Jan 11, 2013 at 17:06 UTC | |
by choroba (Cardinal) on Jan 11, 2013 at 17:21 UTC | |
|
Re: reducing the number of lines
by pvaldes (Chaplain) on Jan 12, 2013 at 13:26 UTC | |
|
Re: reducing the number of lines
by choroba (Cardinal) on Jan 11, 2013 at 17:25 UTC | |
|
Re: reducing the number of lines
by locked_user sundialsvc4 (Abbot) on Jan 11, 2013 at 17:33 UTC |