Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^7: Delete a line from files

by choroba (Cardinal)
on Oct 13, 2015 at 10:27 UTC ( [id://1144671]=note: print w/replies, xml ) Need Help??


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

It doesn't work. The diamond operator opens the file and reads from it at the same time, you can't first open the file and then set the variable. Check the difference yourself:
perl -pwe '$^I = ".bak"; s/[<>]/|/g' file1 perl -pwe 'BEGIN { $^I = ".bak" } s/[<>]/|/g' file2
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1144671]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-23 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found