croak "I expected a hash reference!" unless $ref_type eq ref {} ref {} 这个什么东东? **这个语法? 补充问题: 在perl 怎么定义一个constant 东东。
[code]#!/usr/bin/perl-w $Data::Dumper::Purity=1; use Data::Dumper; my @data1=qw(one won); my @data2=qw(two too to); push @data2,\@data1; push @data1,\@data2; print Dumper(\@data1,\@data2);[/code]输出结果为: $VAR1 = [ 'one', 'won', [ 'two', 'too', 'to', [] ] ]; $VAR1->[2][3] = $VAR1; $VAR2 = $VAR1->[2];...
本帖最后由 perlvim 于 2013-02-23 22:40 编辑 intermediate perl 第一章 intermediate perl 第二章 intermediate perl 第三章 intermediate perl 第四章 intermediate perl 第五章 intermediate perl 第六章 intermediate perl 第七章 intermediate perl 第八章 intermediate perl 第九章 intermediate 第十章 intermediate perl 第十一章 intermediate perl 第十二章 许多链接都失效了,大家可以到这里看: https://github....
今天看了 《intermediate perl 2nd EDITION》 看到第四章Introduction to References的时候发现一个问题, 一下是英文版截图:(英文版第37页Doing the Same Task on Many Arrays那节) 这里是不是写错了?perl的子程序的默认传参机制是“引用传递”的。如果你要“按值传递”的,你需要显式的写 例如: my @params = @_; 上文说不会修改到原来的数组? 哥做了一个测试: #!/usr/bin/per use strict; use warnings; my @required =...
2. 4. 1. 习题 1 [15 分钟] 写一个程序从命令行取一个文件清单, 然后用 grep 把那些文件大小在 1000 字节以内的文件找出来。 用 map 把这个清单里的每个字串前加四个空格并在字串后面加上换行符。 然后输出列表结果。 use warnings; use strict; my $dir = "f:/work"; my $file; my @dir; $dir = shift; chomp $dir; opendir( DIR, $dir ) or die "can't open the directory!"; @dir = readdir DIR; #print "@dir\n"; print m...