如何在Perl單行中獲取當前文件的文件名?

[英]How to get the filename of the current file in a Perl one-liner?


Is it possible to get the current filename (from a list of files) in a Perl one-liner like this below?

是否可以在Perl單行中獲取當前文件名(來自文件列表),如下所示?

perl -lane 'if ($_=~/my_value/) { print $_; }' *.txt

1 个解决方案

#1


12  

The name of the variable is $ARGV. You can find out about it in perlvar, $ARGV.

變量的名稱是$ ARGV。你可以在perlvar,$ ARGV找到它。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2015/02/22/72fbac45fde6fc253c9b5824d08b5f7a.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com