http://www.perlmonks.org?node_id=11132576

LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

Yesterday I needed a Perl one-liner ( -e ) to loop over ( -n ) several subtitle files glob*.srt to find those which are in sync with the video I had.

Hence I needed paragraph mode ( -00 ) to see the timestamps

=== FILENAME.srt === 672 00:35:09,358 --> 00:35:11,027 Ditto ...

trouble is cmd.exe doesn't do *glob expansion, and my git-bash didn't like the paragraph mode, most probably because of different understandings of line endings

I ended up with something like this

perl -00nE"BEGIN{@ARGV=<@ARGV>}say qq{=== $ARGV ===\n$_} if /ditto/i" *Filenames*

but the BEGIN block is a bit ugly.

Any more elegant way to do this?

One generic workaround could be a special module wglob to do the BEGIN part with perl -Mwglob but I'd like to ask the community first...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery