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


in reply to Re: One liner with globs on Windows to parse .srt files
in thread One liner with globs on Windows to parse .srt files

Yeah, that's basically the same idea, but a bit longish for a one-liner, don't you think?

Using INIT{@ARGV=<*inlined-glob-pattern*>} has less characters ...

update

hmm wait tho ...

... I could use the ENV-var PERL5OPT to always preload that module for all Perl scripts in the current cmd.exe :)

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

  • Comment on Re^2: One liner with globs on Windows to parse .srt files (update)
  • Download Code

Replies are listed 'Best First'.
Re^3: One liner with globs on Windows to parse .srt files
by haukex (Bishop) on May 14, 2021 at 11:28 UTC
    Yeah, that's basically the same idea, but a bit longish for a one-liner, don't you think?

    Dunno, seemed like the most straightforward answer to your question - just copy Win32\Autoglob.pm to wglob.pm ;-)

    ("'-M5;@ARGV=<*.srt>' -e'...'" actually doesn't save any characters over "-e'BEGIN{@ARGV=<*.srt>}...'")

    Update: Regarding PERL5OPT, sure!

      > '-M5;@ARGV=<*.srt>'

      nice, I didn't know that trick to add "normal" code after the import; part of use 5 =)

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

        nice, I didn't know that trick to add "normal" code after the import; part of use 5 =)

        Note unfortunately it doesn't end up inside the BEGIN:

        $ perl -MO=Deparse '-M5;print "Hello"' -e 'print "World"' sub BEGIN { require 5; () } print 'Hello'; print 'World';

        The trick was added to perlsecret as the "Maori Farewell" by Discipulus after I posted about it here.