http://www.perlmonks.org?node_id=1012923


in reply to reducing the number of lines

Without any test data, it's hard to tell it this runs the same as your original, but...

my ($max, $cval, $inc_var, $sref, $d_or_b) = ($l == $k) ? ([$k,$lt], 0, undef, \@s, $b) : ($l < $k) ? ([$k,$lt], 2, \$j, \@s_rev, $d) : ([$l,$kt], 1, \$i, \@s, $b); $sref->[$d_or_b+1] ||= $max->[0] - 2 if $max->[0] > 2; $h = $s[$b] == 0 ? 0 : $s[$b]-1; $s[$b1] = max(@$max); $c = $cval; $$inc_var++ if $inc_var; $h = $c = 0 if ( $l==$k );

Update #1: Thanks choroba, colons fixed.

Update #2: Thanks choroba again for the test script template; minor adjustments, works now.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: reducing the number of lines
by choroba (Cardinal) on Jan 11, 2013 at 17:21 UTC
    Aren't you missing a colon somewhere?
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ