in reply to Perl using $seen with regex

I don't understand what you're trying to do. Note that according to perlrun, the -a autosplit switch can only be used with the -n or -p switches. (Update: The fact that you have what looks like a file name at the end of the OPed pseudo-code suggests you intended to use a -n or -p switch.)

You seem to be trying to use the ! $seen{ $string }++ idiom. Maybe the following will help clarify the situation although it doesn't actually use the autosplit feature (but neither does the OPed (pseudo)code).

Win8 Strawberry 5.30.3.1 (64) Sun 07/17/2022 22:13:06 C:\@Work\Perl\monks\abdan >cat story.rst seen first the first found found second seen second first occurred occurred second >perl -ane "print if /(seen|found|occurred)/ && !$seen{ $1 }++" story. +rst seen first the first found first occurred


Give a man a fish:  <%-{-{-{-<