http://qs1969.pair.com?node_id=11127810


in reply to Re: Renaming all files in a directory
in thread Renaming all files in a directory

Why needs the counter be inside a BEGIN block?
  • Comment on Re^2: Renaming all files in a directory

Replies are listed 'Best First'.
Re^3: Renaming all files in a directory
by Cristoforo (Curate) on Feb 02, 2021 at 16:57 UTC
    In this example, perl is reading line by line, (perl -nle ...) and you want the counter to only be initialized (once) at the start of the script.