How do I run a Perl script on multiple input files

2019-01-15 19:12发布

How do I run a Perl script on multiple input files with the same extension?

 perl scriptname.pl file.aspx

I'm looking to have it run for all aspx files in the current directory

Thanks!

7条回答
别忘想泡老子
2楼-- · 2019-01-15 19:51

you can pass those files to perl with wildcard

in your script

foreach (@ARGV){
    print "file: $_\n";
    # open your file here...
       #..do something
    # close your file
}

on command line

$ perl myscript.pl *.aspx
查看更多
登录 后发表回答