13.07.2015 Views

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

从 shell 上 , 你 说 :%perl -p -i.oirg -e "s/foo/bar/;"等 效 于 使 用 下 面 的 程 序 :#! /usr/bin/perl -pi.origs/foo/bar/;而 上 面 的 又 是 下 面 的 程 序 的 便 利 缩 写 :#! /usr/bin/perl$extension = '.orig';LINE: while(){if ($ARGV ne $oldargv) {if ($extension !~ /\*/) {$backup = $ARGV . $extension;}else {($backup = $extension) =~ s/\*/$ARGV/g;}unless (rename($ARGV, $bckup)) {warn "cannot rename $ARGV to $backup: $! \n";close ARGV;505

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!