On Sun, 3 Nov 2019 13:51:19 -0700 Philip Prindeville wrote: > then $uniq{A} is 4, but the number of elements in @hdrs would be 1 > (because of the ‘!’ which only passes the first). > > This seems counter-intuitive. What if I want to count the absolute > number of headers of type ‘X-yzzy:’ regardless of their RHS? > > I’ve been seeing a lot of Spam recently with duplicative > Received-SPF: lines, but since they are all identical, it’s not > nudging the number of @hdrs past one.
You shouldn't need perl for this. Header tests run on a string that contains all the RHS's for the named header, so something like the following should do it: header __RECSPF_COUNT Received-SPF =~ /^.*$/m tflags __RECSP__COUNT multiple