Help for this page
#!/usr/bin/perl ... $_ = "#tag1 #tag2 #tag3 #tag1\n"; 1 while s/(#\w{2,})\b.*\K\1\b\h*//; print "keeping only the first one: $_";
original: #tag1 #tag2 #tag3 #tag1 keeping only the last one: #tag2 #tag3 #tag1 keeping only the first one: #tag1 #tag2 #tag3