> Hi guys
> I was wondering if you could help me.
> If I read a value of 123.456 and I would like to print this value out as
> 123456 (without decimals), how can I go about it without doing any
> multiplication ?

$number =~ tr'.''d; # Use transliteration to delete the dot.

There are of course other ways to do this, perhaps neater.  Changing tr to
y makes it even shorter.  Note that the value returned by this function
isn't usually very useful - it's the number of transliterations made, not
the new string.  If you need to keep the dot, use:

($new_number = $old_number) =~ tr'.''d;

Which means:

Set $new_number to $old_number, but transform via tr'.''d before doing the
assignment.

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to