in reply to adding an IF to a push
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: adding an IF to a push
by sulfericacid (Deacon) on Jun 28, 2006 at 03:56 UTC | |
by ikegami (Patriarch) on Jun 28, 2006 at 04:40 UTC | |
by sulfericacid (Deacon) on Jun 28, 2006 at 04:45 UTC | |
by ikegami (Patriarch) on Jun 28, 2006 at 05:15 UTC | |
by sulfericacid (Deacon) on Jun 28, 2006 at 05:30 UTC | |
by Anonymous Monk on Jun 28, 2006 at 05:40 UTC | |
by ikegami (Patriarch) on Jun 28, 2006 at 06:01 UTC | |
by shmem (Chancellor) on Jun 28, 2006 at 06:01 UTC | |
by ikegami (Patriarch) on Jun 28, 2006 at 06:13 UTC | |
|