Your proposed if form is correct. The parens are unnecessary for a "statement modifier" if like that, but they don't do any harm if you prefer to keep them.
You can link two conditions with and if you want to fail unless both are true. The additional processing you need can be wrapped up in a do block.
push @array, $string =~ m#stuff#g if do { my $img = get($image); my ($height, $width) = imgsize(\$img); $height < $max_h and $width < $max_w; };
After Compline,
Zaxo
In reply to Re: adding an IF to a push
by Zaxo
in thread adding an IF to a push
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |