|
这个脚本是我的一个练习~~,挺有趣的,包括了必要的基础知识~~- #!perl -w
- $rand=int(1 + rand 100);
- while (1) {
- print "Please input number from 1 to 100:";
- chomp($input=<>);
- if ($input =~ /quit|exit|^\s*$/i) {
- print "Sorry,You lose!\nThe rand-number is: $rand\n";
- last;
- } elsif ($input lt$rand) {
- print "Too small,Try input again!\n";
- } elsif ($input eq $rand) {
- print "You win!\n";
- last;
- }else {
- print "Tool large.Try input again!\n";
- }
- }
复制代码 |
|