Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Why am I getting wrong result in basic arithmetic calculations from d5.pl for $calculation1 and $calculation2?

by supriyoch_2008 (Monk)
on May 07, 2012 at 04:05 UTC ( [id://969185]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    x1=2; x2=3; x3=4;
    y1=3; y2=5; y3=7;
    z1=4; z2=7; z3=10;
    
  2. or download this
    #!usr/bin/perl-w
    print"\n  Type the name of data file: ";
    $data=<STDIN>;
    ...
    $calculation1=$vals{x1}*$vals{y1};
    print"\n\n  1st result=$calculation1;\n\n";
    exit;
    
  3. or download this
    C:\Users\xyz\Desktop>d6.pl
    
      Type the name of data file: data.txt
      1st result=6;
    
  4. or download this
    #!usr/bin/perl-w
    print"\n  Type the name of data file: ";
    $data=<STDIN>;
    ...
    print"\n\n  1st result=$calculation1;\n\n
      2nd result=$calculation2";
    exit;
    
  5. or download this
     C:\Users\xyz>cd desktop
    C:\Users\xyz\Desktop>d5.pl
    
      Type the name of data file: data.txt
    Illegal division by zero at C:\Users\xyz\Desktop\d5.pl line 15.
    
  6. or download this
      1st result=6;
       2nd result=2;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://969185]
Approved by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-18 22:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found