in reply to Re^3: How to check lines that start with the same word then delete one of them
in thread How to check lines that start with the same word then delete one of them

Pretty much what I meant, thanks!

Minor nitpick, I'd assign the first match to a normal var.

Special vars like $1 can get overwritten easily by "more code" before seen is set.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^4: How to check lines that start with the same word then delete one of them

Replies are listed 'Best First'.
Re^5: How to check lines that start with the same word then delete one of them
by hippo (Archbishop) on Apr 10, 2020 at 13:38 UTC

    Cool - glad we're in agreement.

    You are quite right about limiting the chances of stomping on $1 and friends, of course. The test script could be polished no doubt but I didn't want to spend/waste time on that before agnes00 confirmed that this does actually solve the problem. The requirements as stated were a little wooly.

      > I didn't want to spend/waste time on that ... The requirements as stated were a little wooly.

      That's why I thanked you for implementing it. :)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery