CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
Perl float point equations.

 



TIGA
New User

Jun 23, 2009, 6:39 AM

Post #1 of 2 (3620 views)
Perl float point equations. Can't Post

Hi Guys.

I cannot seem to get the following equation work in perl.

it says cnanot divide by 0, i know that perl converts decimal numbers to a int.

but whats the work around to this?.


Code
my $x = 60/(10/4



(This post was edited by TIGA on Jun 23, 2009, 6:43 AM)


FishMonger
Veteran / Moderator

Jun 23, 2009, 8:59 AM

Post #2 of 2 (3616 views)
Re: [TIGA] Perl float point equations. [In reply to] Can't Post

The workaround to what? An incomplete assignment statement?


Code
C:\TEMP>type test.pl 
use warnings;
use strict;

my $x = 60/(10/4);
print $x;

C:\TEMP>test.pl
24


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives