chomp

用来除去最后的换行等空白字符。

例程:

#!/usr/bin/perl
#chomp.pl
use warnings;
use strict;
print "Input a string & a number by order!\n";
my$the_str = <>;
my$the_numb=<>;
print "Input a string & a number by order!\n";
chomp(my$str_=<>, my$num_=<>);print "The result is :";
print $the_str," ",$the_numb;
print "The result(chomp) is :";
print $str_," ",$num_;

 

运行结果:

$ perl array.pl
Input a string & a number by order!
no chomp
123
Input a string & a number by order!
has chomp
456
The result is :no chomp123
The result(chomp) is :has chomp 456

 

转载于:https://www.cnblogs.com/qiyuexin/p/8823992.html


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部