We don't bite newbies here... much PerlMonks

### Re^4: adding an IF to a push

by sulfericacid (Deacon)
 on Jun 28, 2006 at 04:45 UTC ( #557925=note: print w/replies, xml ) Need Help??

Actually I was going to go out on a lim and try
```my \$num = 5;

{
my \$shift = shift;
my \$num2 = 10;
my \$sum = \$num1 + \$num2;

if (\$sum == "15")
{
return 1;
}
else
{
return 0;
}
}
But after playing through numerous attempts, I couldn't pull it off. I just figured you should be able to test the return of a sub this way, though I've never thought of trying it until now.

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
Re^5: adding an IF to a push
by ikegami (Pope) on Jun 28, 2006 at 05:15 UTC

Change
to

In context, it would actually be:

```sub is_image_size_ok {
my (\$image) = @_;
my \$img = get(\$image);
my (\$height, \$width) = imgsize(\\$img);
return \$height < \$max_h and \$width < \$max_w;
}

push @array, \$string =~ m#stuff#g
if is_image_size_ok(\$image);
Thank you ikegami for clearing that up. I knew it was possible but I couldn't get the syntax to work although now that I look back, I have to wonder what I was thinking in the first place. Easy stuff.

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Create A New User
Node Status?
node history
Node Type: note [id://557925]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-11-21 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In order to be able to say "I know Perl", you must have:

Results (312 votes). Check out past polls.

Notices?