scalar:伪函数非真正的函数,强制引入标量上下文
#!/usr/bin/perl -w
@rocks=qw(a b c d f);
print "How many rocks do you have?\n";
print "I have ",scalar @rocks," rocks!\n";
输出结果:
How many rocks do you have?
I have 5 rocks! # 打印出rocks的种树
@lines=;
chomp(@lines);
or
chomp(@lines=); #读入所有行,去掉所有换行符(换行符除外).
阅读(573) | 评论(0) | 转发(0) |