Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!att!linac!midway!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.perl Subject: Re: perl compared to other Unix tools (was: a pointer for a perl compare script) Message-ID: <1990Dec09.052353.18018@chinet.chi.il.us> Date: 9 Dec 90 05:23:53 GMT References: <275E7B47.2EB9@tct.uucp> <1990Dec8.020706.28417@midway.uchicago.edu> Organization: Chinet - Public Access UNIX Lines: 34 In article <1990Dec8.020706.28417@midway.uchicago.edu> goer@ellis.uchicago.edu (Richard L. Goerwitz) writes: >The point was not that there were other tools out there which could >replace perl, but rather that certain features found in perl (e.g. good >string handling facilities, associative arrays, and what not) were by no >means unique, and that for problems which required such facilities, perl >was by no means a unique tool. Ok, sticking to the text handling features relating to the original question, there may be other languages that would easily sort text by keys. But there was also a mention of needing to manipulate it when a match occured. Does anything else let you do those wonderful combination test, assign and regexp extract like perl's: if (($got1,$got2,$got3) =($var =~ /(pattern1) (pattern2) (pattern3))) { ... do whatever you want with $got1 etc. } Or handle multi-line regexps like this piece from the example I posted where it takes everything between a SUMMARY: line and STATUS: line in one item and inserts it before the STATUS: in an update which lacks the SUMMARY information? local ($*) = 1 ; # multi-line match needed [...] # snarf summary from old - note multi-line if (($status) = $oitems{$oldid} =~ /(^SUMMARY:\n[^\0]*)^STATUS:/) { # and insert into new substr($nitems{$newid},index($nitems{$newid},"STATUS:\n"),0) = $status ; } Yes, you could loop over the lines (or characters) explicitly, but why? Les Mikesell les@chinet.chi.il.us