1. select函数
select FileHandl
该函数用来设置输出的文件句柄为默认文件句柄,并返回以前默认的文件句柄。最原始的默认文件句柄是 ‘main::STDOUT’ ,即标准输出。为了输出的方便,可以使用该函数指定默认的输出。
使用例子:
open FILE, '>', "job"; $oldHandle = select ( FILE ); print "This is sent to $oldHandle\n";print "This is sent to $oldHandle\n"; $origin = select ( $oldHandle ); print "This is sent to $origin\n";
2. 查找perl模块或卸载
使用以下命令列出所有perl模块的位置。eg:通过grep GD,来找出GD模块所处位置,然后直接rm掉即可。
$ perl -MFile::Find -le 'finddepth({wanted=>sub{print $_ if/\.pm$/},no_chdir=>1},@INC)' | grep 'GD'
/usr/local/lib64/perl5/GD.pm
/usr/local/lib64/perl5/GD/Simple.pm
/usr/local/lib64/perl5/GD/Polygon.pm
/usr/local/lib64/perl5/GD/Image.pm
/usr/local/lib64/perl5/GD/Group.pm
/usr/local/lib64/perl5/GD/Polyline.pm
/usr/local/share/perl5/GD/SVG.pm
/usr/local/share/perl5/Bio/Graphics/GDWrapper.pm
/usr/lib64/perl5/GDBM_File.pm
3. 十进制转二进制
$a = sprintf("%b",$a)+0;
$ perl -MFile::Find -le 'finddepth({wanted=>sub{print $_ if/\.pm$/},no_chdir=>1},@INC)' | grep 'GD' /usr/local/lib64/perl5/GD.pm /usr/local/lib64/perl5/GD/Simple.pm /usr/local/lib64/perl5/GD/Polygon.pm /usr/local/lib64/perl5/GD/Image.pm /usr/local/lib64/perl5/GD/Group.pm /usr/local/lib64/perl5/GD/Polyline.pm /usr/local/share/perl5/GD/SVG.pm /usr/local/share/perl5/Bio/Graphics/GDWrapper.pm /usr/lib64/perl5/GDBM_File.pm
3. 十进制转二进制
$a = sprintf("%b",$a)+0;