in reply to Re^2: compare lists and delete unwanted from file
in thread compare lists and delete unwanted from file

Of course!

The (?{ ... }) is how you insert code into a regex. Whenever you see (? ... ), it generally means you are doing something with whatever is found inside, but you don't want to capture it. For instance (?: ... ) works just like a capture group but without actually capturing.

Whenever you insert code into a regex, it's always a good idea to add the /x modifier, which tells the regex compiler to ignore all whitespace. This means you'll either need to escape whitespace (i.e., '\ '), or (even better) just use \s.

The /g modifier means to match globally. This does different things depending on whether you're using s/// or m//. The former does it all at once, but the latter simply continues matching wherever the previous match left off, meaning you need a loop to match everything.

  • Comment on Re^3: compare lists and delete unwanted from file