+ -
当前位置:首页 → 问答吧 → perl语言入门练习问题

perl语言入门练习问题

时间:2011-03-20

来源:互联网

print "Please input your first name: ";
my $first_name = <STDIN>;
chomp($first_name);   
my %last_name = (
    "fred" => "flintstone",
    "barney" => "rubble",
    "wilma" => "zl",
);
while (exists $last_name{$first_name}) {
    print $last_name{"$first_name"};
    chomp($first_name=<STDIN>);            
    exit 0;
}
print "Not found.\n";


不清楚为何会有这一句,在while 里?
   chomp($first_name=<STDIN>);

作者: shot   发布时间: 2011-03-20

去 \n 用的

作者: BangBull   发布时间: 2011-03-20