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


in reply to reducing the number of lines

I need to rewrite this in a more simpler form

$k-2>0 $l-2>0

Same as:

$k>2 $l>2

And you can save one line here

$h=0; $c=0;

same as:

($h,$c) = (0,0);

Updated: the tobyink's solution is more elegant

$h = $c = 0