在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