Perl替换库subst.pm

package subst;
sub subst_casename
{
my ( f i l e , file, tmp) = @_;
open(FILE,"<$file") || die “Cannot open this file!”;
my @lines = ;
close FILE;

my @newlines;
foreach(@lines)
{
    $_ =~s/\/case.*\.(v|fsdb)/\/$tmp/g;
    push(@newlines,$_);
}

open(FILE,">$files") || die “Connot open this file!”;
print FILE @newlines;
close FILE;
}
1;

使用:
#!/usr/bin/perl -w
use lib ‘/home/wudw/script/perl_lib’;
use subst;

subst::subst_casename(参数1,参数2);

发布了1 篇原创文章 · 获赞 0 · 访问量 17

猜你喜欢

转载自blog.csdn.net/WDWCSDN123/article/details/104902499