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: Perl Programming Help: Beginner:
CGI textfield: how to display the big int without scientific format ?

 



ningji
Novice

May 3, 2013, 2:11 PM

Post #1 of 2 (302 views)
CGI textfield: how to display the big int without scientific format ? Can't Post

Hi i have a textfield,

print $q->Tr(
$q->td('Start record on page'),
$q->td(
$q->textfield(-name => "first_record_on_page", -size => 80,
-override=>1,
-default=>5000,
-value=>$firstRec)
)
);

I type a number 76600000000554300220011162348 into this field in the webpage,
click "submit" to trigger my perl scripts.

now the webpage gets refreshed, and this field is displayed as
7.66000000005543e+28

is there a way it can display in the original format ?

Thanks !


FishMonger
Veteran / Moderator

May 3, 2013, 2:18 PM

Post #2 of 2 (300 views)
Re: [ningji] CGI textfield: how to display the big int without scientific format ? [In reply to] Can't Post

Add the bigint pragma.

Code
use bigint;

c:\testing>perl -Mbigint -e "$num=76600000000554300220011162348; print $num;"
76600000000554300220011162348


If that doesn't work for you, there are other modules, such as Math::BigInt.
http://search.cpan.org/~pjacklam/Math-BigInt-1.997/lib/Math/BigInt.pm

 
 


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

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