Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Surviving 'Illegal division by zero'

by ViceRaid (Chaplain)
on Jun 23, 2004 at 11:52 UTC ( [id://369011]=note: print w/replies, xml ) Need Help??


in reply to Re: Surviving 'Illegal division by zero'
in thread Surviving 'Illegal division by zero'

Thanks, but I've got lots and lots of these calculations, and what I'd like to be able to do is scope-globally adjust the behaviour, rather than have to wrap every block in either an eval or a conditional.

On reflection, a function mydiv:

sub mydiv { my ( $divided, $divisor ) = @_; $divisor ? $divided / $divisor : undef; } my $growth = mydiv($fig_2, $fig_1);

Might have been easier, but Abigail-II's answer is another way of getting to it as well.

Thanks
Alex

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://369011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-03-28 23:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found