S
Suresh Govindachar
#!/usr/bin/perl
use warnings;
use strict;
use CGI qw
standard);
=head
This .pl file runs correctly on a linux box, but gives
the following wrong output on Win98 active perl 5.8.0:
|>perl bug.pl
| Enter a number (>=1): 1234
|
| rolls of a fair die:34
|
| was returned from get_input
Commenting out either one of (not necessarily both of)
the lines "use CGI qw
standard);" or "chomp $number;"
generates expected output.
What is the explanation?
Thanks,
--Suresh
=cut
my $the_number = &get_input;
print "\n\tResults of $the_number rolls of a fair die:\n\n";
print "The number $the_number was returned from get_input\n\n\n";
#### get_input ##################################
sub get_input()
{
my $number = 0;
{
print "\tEnter a number (>=1): ";
$number = <STDIN>;
chomp $number;
($number <=0) and redo;
}
return $number;
}
use warnings;
use strict;
use CGI qw
=head
This .pl file runs correctly on a linux box, but gives
the following wrong output on Win98 active perl 5.8.0:
|>perl bug.pl
| Enter a number (>=1): 1234
|
| rolls of a fair die:34
|
| was returned from get_input
Commenting out either one of (not necessarily both of)
the lines "use CGI qw
generates expected output.
What is the explanation?
Thanks,
--Suresh
=cut
my $the_number = &get_input;
print "\n\tResults of $the_number rolls of a fair die:\n\n";
print "The number $the_number was returned from get_input\n\n\n";
#### get_input ##################################
sub get_input()
{
my $number = 0;
{
print "\tEnter a number (>=1): ";
$number = <STDIN>;
chomp $number;
($number <=0) and redo;
}
return $number;
}