小编dis*_*tro的帖子

需要有'if'陈述的建议

我需要帮助调整我的代码块.一切正常,但随后它停止工作并且每次都失败(打印).我究竟做错了什么?

print "Enter a word to search for:";
chomp (my $word = <STDIN> );
if (not -e $word){
        print "No such word found.\n";
        exit;
}
Run Code Online (Sandbox Code Playgroud)

整个计划.

#!/usr/bin/perl -w


use strict;


print "Welcome to the word frequency calculator.\n";
print "This program prompts the user for a file to open, \n";
print "then it prompts for a word to search for in that file,\n";
print "finally the frequency of the word is displayed.\n";
print " \n";


print "Please enter the name of …
Run Code Online (Sandbox Code Playgroud)

perl if-statement

1
推荐指数
1
解决办法
72
查看次数

标签 统计

if-statement ×1

perl ×1