in reply to Delete a line from files

read perlintro (and read it well, from the beginning), read when it talks about creating and initializing variables with my, opening files with open/binmode, reading the files in a while loop with readline, print strings to new file handle, and testing strings with m//atch operator in Simple matching/perlrequick

Editing a file is fours steps

And maybe read Path::Tiny if you like convenience methods