I'm real new to perl, but here's what I'm doing (The sub isn't working correctly).
########### BEGIN PROGRAM ############
#!/usr/bin/perl
$x = $getnumber;
$y = $getnumber;
$z = $x + $y;
print "$x + $y = $z";
sub getnumber {
print "Enter a number \n";
$number = <>;
chop($number);
$number
}
############ END PROGRAM ##############
Now when I spit this through I get:
+ = x
I have yet to get a sub to work correctly. Am I doing something drastically wrong?
Thanks everyone!
M. Carter Brown
- Re: Real new.... sub not working correctly. Carter and Cathleen
- Re: Real new.... sub not working correctly. jduncan
- RE: Real new.... sub not working correctly. Sally
- Re: Real new.... sub not working correctly. Ondrej Par
- Re: Real new.... sub not working correctly. Stefaan Verscheure
- Re: Real new.... sub not working correctly. Marcelo E. Magallon
