I don't tend to use filters much, but I thought a little and here are a few I came up with. 1) Number the lines in selected region. It's useful when you want to number the lines starting with 1 somewhere in the middle of the file. #!perl -n printf("%4d: $_",++$i); 2) Reverse the elements of all comma-separated lists in the region. For instance, turn (one, two, "three", 4) into (4, "three", two, one). #!perl -p s/\((.*?)\)/ '('. join ('', reverse split m{(\s*,\s*)}, $1) . ')' /eg; 3) Alphabetical list of all words in the selection. #!perl -nl @h{/(\w+)/g} = (); END { foreach (sort {lc $a cmp lc $b} keys %h) {print} } rdm@cfcl.com (Rich Morin) wrote: >BBEdit (a fine GUI-based text editor for Macs) is capable of running >MacPerl-based filters on selected text. I understand that some other >editors (e.g., vim) also have this capability. > >I would love to have some intriguing demo filters on hand at WWDC (the >Apple World Wide Developers Conference) in a week or so. They should >have a strong "Gee Whiz!" factor. It would also be nice if they can >be explained to mortal programmers... > >Does anyone feel like suggesting (or even coding up :-) something? > >-r >-- >Rich Morin: rdm@cfcl.com, +1 650-873-7841, http://www.ptf.com/~rdm >Prime Time Freeware: info@ptf.com, +1 408-433-9662, http://www.ptf.com >MacPerl: http://www.macperl.com, http://www.ptf.com/ptf/products/MPPE >MkLinux: http://www.mklinux.apple.com, http://www.ptf.com/ptf/products/MKLP > ># ===== Want to unsubscribe from this list? ># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org > ------------------- ------------------- Ken Williams Last Bastion of Euclidity ken@forum.swarthmore.edu The Math Forum # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org