在perl中执行shell命令

 在perl的模块库中有一个Shell.pm可以很方便地执行shell命令.

use Shell qw(cat ps cp);
$passwd = cat('</etc/passwd');
@pslines = ps('-ww'),
cp("/etc/passwd", "/tmp/passwd");

#面向对象方式
my $sh = Shell->new;
print $sh->ls('-l');

参考 http://search.cpan.org/~ferreira/Shell-0.72/Shell.pm

 

你可能感兴趣的:(shell,职场,perl,休闲)