in reply to mathematical operator for integer division, "div" ?

Not math, but perl -le 'print sprintf("%.0f", 5/3);'.

Try perldoc -q round for a more complete answer.

Update: monsieur_champs++ might well be right, but the AnonyMonk's question is unclear. 5/3 rounded to the nearest integer is 2, but so is 5 % 3 :-)


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.

Replies are listed 'Best First'.
Re: Re: mathematical operators
by monsieur_champs (Curate) on Jun 17, 2003 at 14:34 UTC

    Dear BazB

    Our anonymous fellow was asking about the remainder operator (%). What I see here is a (useful, indeed) number formatting tip. Please correct this one. ++BazB for his sincere and humble signature asking for other monks to teach him.

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Just Another Perl Monk