chomp是用来删除换行符.
[root@rs1 ~]# cat t.pl
#!/usr/bin/perl
my $c="I love me";
chomp($c);
print "$c\n";
[root@rs1 ~]# ./t.pl
I love me
[root@rs1 ~]#
chop是用来删除最后一个字符.
[root@rs1 ~]# cat t.pl
#!/usr/bin/perl
my $c="I love me";
chop($c);
print "$c\n";
[root@rs1 ~]# ./t.pl
I love m
[root@rs1 ~]#
阅读(1015) | 评论(1) | 转发(0) |