LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-30-2004, 10:30 AM   #1
rajatgarg
Member
 
Registered: Oct 2003
Posts: 41

Rep: Reputation: 15
perl print double in proper format


Hi Everybody,
Another small issue that is nagging me,

If I have $a = 24.4444444444;
then how to print $a in rounded form without using any split.

anyone knows of any options which can :

print "$a"; and output becomes 24;

Regards,
Rajat Garg
 
Old 01-30-2004, 12:57 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Try:
Code:
$a = 24.4444444444;
print int($a);
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about proper video format to burn to dvd Rick069 Linux - Software 1 11-11-2005 02:50 AM
how to print 2 decimal places of a double? nadroj Programming 6 07-12-2005 11:03 AM
Print one page get double tarheel92x Linux - Networking 0 02-11-2004 05:15 PM
Linux - ASCI - Windows, proper file format issue aaronluke Linux - General 1 11-07-2002 10:47 PM
How do I print double sided output rdaves@earthlink.net Linux - General 1 06-27-2001 02:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration