develooper Front page | perl.beginners | Postings from October 2009

newbie question : about the perl sprintf

Thread Next
From:
Majian
Date:
October 21, 2009 05:52
Subject:
newbie question : about the perl sprintf
Message ID:
eb686fc70910210552u31c3c7fax4209064720e1d0dd@mail.gmail.com
Hi, all ;

           I want to print  this sentence " The number in scientific
notation is 1.255000e+02".

         So   I write a perl script like this :
               #!/usr/bin/perl
                sprintf "The number in scientific notation is %e", 1.255;
           But  the screen output is "The number in scientific notation is
1.255000e+00"

            And  I modify it like this "sprintf "The number in scientific
notation is %e", 01.255;"
                The screen now output is " The number in scientific notation
is 1.255000e+03"


           I don't know how I can display the correct answer .

      Please forgive me if this is a very simple question on Perl . I am a
Perl newbie ~~~


          Thanks ~~~

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About