#!/usr/bin/perl -w
use strict;
my $data=int(rand(50));
my $time=0;
my $biggertime=0;
my $smallertime=0;
print "please input the data:\n";
my $input=;
chomp($input);
#AARONVOX:
#while (1)
#{
# do something
# my $xxx = <>;
# goto AARONVOX if $xxx =~ /Hello/;
#}
AARONVOX:
while ($input gt $data )
{
$biggertime+=1;
print " the input is too LARGE ! please input again;\n";
$input=;
chomp($input);
goto AARONVOX if $input gt $data;
goto BARONVOX if $input lt $data;
}
BARONVOX:
while ($input lt $data )
{
$smallertime+=1;
print " the input is too small ! please input again;\n";
$input=;
chomp($input);
goto AARONVOX if $input gt $data;
goto BARONVOX if $input lt $data;
}
$time=$smallertime+$biggertime+1;
print " the input it : $input,this rand is : $data ,\n";
print "your input times is $time:\n";
print " Your input is bigger has times : $biggertime\n ";
print "your input is smaller has times :$smallertime\n";
阅读(1092) | 评论(0) | 转发(0) |