This is probably what you're after.
my $cmd = $step_no || 0; # If $step_no is 0, it assigns... uh, 0 over it.Note that if you're accepting user input, like $step_no = param("step") or something you should validate all user parameters before using them in other code. Perhaps-
my $cmd = $step_no =~ /\A\d+\z/ ? $step_no : 0;In reply to Re: reduce line of code
by Your Mother
in thread reduce line of code
by Sun751
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |