>I don't think this is strictly needed. Doesn't "^" always means beginning >of string, unless /m is specified? I'm an old foggy, and a paranoid one. --tom #!/usr/bin/perl # dupwords $| = 1; undef $/; $* = 1; while ( $ARGV = shift ) { if (!open ARGV) { warn "$ARGV: $!\n"; next; } $_ = <ARGV>; s/\b(\s?)(([A-Za-z]\w*)(\s+\3)+\b)/$1\200$2\200/gi || next; split(/\n/); $NR = 0; @hits = (); for (@_) { $NR++; push(@hits, sprintf("%5d %s", $NR, $_)) if /\200/; } $_ = join("\n",@hits); s/\200([^\200]+)\200/[* $1 *]/g; print "$ARGV:\n$_\n"; }