Perl使用chdir的实例代码
use strict;
use warnings;# Print all files in a directory
sub print_files {
my $dir = 'd:/code';
opendir DIR, $dir or die $!;
my @files = readdir DIR;
chdir $dir; # Use chdir or -f will not work, since -f need absolutely path
foreach my $file (@files) {
if (-f $file) {
print "$filen";
}
}
closedir DIR;
}&print_files();
perl特殊符号及默认的内部变量
Perl的特殊符号@数组$x{}x名字前面是美元符号($),后面是花括号({}),则其为hash元素%要引用整个hash,使用百分号()作为前缀。前面几页中使用的hash的名字为%fa
perl中my与our的区别介绍
先来看下our的用法。require5.006当版本号小于5.006的时候,会返回失败,从而导致模块加载失败。所以它的作用就是保证模块调用环境的Perl版本。our和my一
在vim中添加perl注释时无法对齐问题的解决方法
在.vimrc中加入如下几行,即可解决这个问题。"Onlydothispartwhencompiledwithsupportforautocommands.ifhas("autocmd")filetypepluginindentonelsesetautoindentendif"has("autocmd")
标签:百分号,模块,名字,特殊符号,前缀