I’ve been looking around quite a while now for an answer but since I’m very new to perl I could use some help that explains my problem, as I can’t take answers from other threads and tweak their codes.
The closest I got to finding the closest I was to finding a solution was:
How can I write only certain lines of a file in Perl?
It’s the same problem, but I only want to write lines that start with a “/”, is this possible, and if possible, how do I do it?
Any help is very appreciated, thanks in advance!
A simple implementation may look like:
This looks for a
/immediately after the start of the line (^).If you want to allow some whitespace at the start of the lines, change your regular expression to
/^[[:space:]]*\//.Essentially the rest of the script is the same as in the question to which you have linked.