You are not calling your subroutines correctly.
$x = $getnumber;
should read
$x = &getnumber;
You have called a variable which you haven't defined,
Regards,
Sally
-----Original Message-----
From: Carter and Cathleen [mailto:[EMAIL PROTECTED]]
Sent: 04 June 2001 08:34
To: [EMAIL PROTECTED]
Subject: Real new.... sub not working correctly.
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