首页 > 其他 > 详细

chomp

时间:2018-04-13 22:11:54      阅读:175      评论:0      收藏:0      [点我收藏+]

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

例程:

#!/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 chomp
 123
The result(chomp) is :has chomp 456

 

chomp

原文:https://www.cnblogs.com/qiyuexin/p/8823992.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!