in reply to Re^2: Delete a line from files
in thread Delete a line from files

"...the purpose of the BEGIN blocks?"

Begin to read?

Update: Slight losses are usual in every combat.

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^4: Delete a line from files
by Anonymous Monk on Oct 12, 2015 at 21:48 UTC
    I meant why set $^I and $^/ at compile time with Begin?
      These are documented in perlvar
      • for $^I search perlvar for "inplace". This has to be prepared before opening the file
      • $/ (without caret), if you use English, you can call it $INPUT_RECORD_SEPARATOR - should be set before the first read operation
      Update: the BEGIN block is necessary so that these assignments are executed before the implicit loop by the -p flag, see perlrun
        what is wrong with first opening the file with open and then setting those variables?