有趣的事

perl实现备份文件的恢复

还是写点例子吧 免得有人说写的没含量 抄书……

简单的测试,可能有更好的办法以后再说。

#! /usr/bin/perl

#print "Please input the dirc:";
#chomp ( $dirc=);
$dirc = "you dir";
print "You input dirc is: " . $dirc;

@findrets=`find $dirc -name *.html.bak`;
foreach $line ( @findrets )
{
         chomp $line;
         $linee   = substr($line, 0, $line - 4);
         $cmd = "cat $line > $linee";
         print $cmd . "\n";
         system("$cmd");
}

print "\n";

perl

相关阅读