哪位大侠能和我说说 chomp的用法 刚开始学习perl (perl语言入门第五版) 讲到chomp中 有些看不太懂。。 哪位大侠能说说 顺便给个例子 谢谢了
#! /usr/bin/per $char="look this way!"; $/=" this way!"; chomp($char); print $char; 不明白为什么打印出来的结果是:look
$a =
use strict;
use warnings;
open(RF,"<01.txt");
while(my $line=
RT !
帮忙说的详细点~!
多谢多谢!
我自己测试了一下,很糊涂: chomp 得到的是记录数,比如:[code][root@localhost perl]# cat chomp
#!/usr/bin/perl
$test_line=
数据文件
cat c629
http://www.baidu.com/index.html
http://www.baidu.com/1.html
http://post.baidu.com/index.html
http://mp3.baidu.com/index.html
http://www.baidu.com/3.html
http://post.baidu.com/2.html
最后一行是空格和tab。不是空白!
输出每行的长度[code]#!/usr/bin/perl
open(INFILE,"c629")||die "";
my @array01=
如果从标准输入中输入1空行(就是直接回车)再chomp一下,是不是标量里的值就变成了undef了?
perl -e 'chomp($a=
本帖最后由 obsd178 于 2012-09-12 18:02 编辑
[code]
#!/usr/local/bin/perl5.12.4
use utf8;
use 5.12.4;
use strict;
my ($circumference, $radius, $pi);
$pi=3.141592654;
my $xx;
$xx=defined($radius);
say "defined return is:$xx before chomp!";
my $out1;
$out1=chomp($radius=