Hello Newbie,

And let us not forget to scold you on your non-use of "strict". The
use of it in this list will help avoid future flames & find errors in
longer, more complex scripts.

I'll demonstrate the use of it, & include the tips posted thus far...

#!c:/perl/bin/perl -w

use strict;

my $number;
my $mult;
my $result;

print "Enter a number:  ";
chomp($number = <STDIN>);
print "Enter a multiplier:  ";
chomp($mult = <STDIN>);
$result = $number * $mult;
print "The result you ignorant fool is: $result\n";

## OR ##

#!c:/perl/bin/perl -w

use strict;

print "Enter a number:  ";
chomp(my $number = <STDIN>);
print "Enter a multiplier:  ";
chomp(my $mult = <STDIN>);
my $result = $number * $mult;
print "The result, you ignorant fool, is: $result\n";

## OR ##

#!c:/perl/bin/perl -w

use strict;

my ($number,$mult,$result);

print "Enter a number:  ";
chomp($number = <STDIN>);
print "Enter a multiplier:  ";
chomp($mult = <STDIN>);
$result = $number * $mult;
print "The result, you ignorant fool, is: $result\n";



Thursday, July 05, 2001, 5:01:20 PM, you wrote:

CS> I’m sure I could get flamed for this, but I just successfully wrote my first
CS> program! Yaaahhh!

CS> ############## perl ############

CS> #!c:/perl/bin/perl -w

CS> print STDOUT "Enter a number:  ";
CS> chop($number = <STDIN>);
CS> print STDOUT "Enter a multiplier:  ";
CS> chop($mult = <STDIN>);
CS> $result = $number * $mult;
CS> print STDOUT "The result you ignorant fool is: $result\n";


CS> Cool, huh?  Not gonna win any awards, but at least I know how to use STDIN
CS> and STDOUT.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+===================================================+
+   "Inherently, each one of us has the substance   +
+   within to achieve whatever our goals and dreams +
+   define. What is missing from each of us is the  +
+   training, education, knowledge and insight to   +
+   utilize what we already have." -- Mark Twain    +
+===================================================+


Reply via email to