Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!mit-eddie!uw-beaver!ubc-cs!alberta!news From: jimmy@therien.cs.UAlberta.CA (Jimmy the X-man) Newsgroups: comp.lang.perl Subject: Should I SWITCH to perl ? Message-ID: <1991Feb1.181223.25788@cs.UAlberta.CA> Date: 1 Feb 91 18:12:23 GMT Sender: news@cs.UAlberta.CA Distribution: na Organization: for the criminally pleasant Lines: 70 Folks, I have been a sh/awk/sed user for a number of years; however, I was told by someone recently that perl can replace ALL of the above. Is this true ? Was this the intention of the original design ? In other words, if I concentrate in developing my perl skills, can I forget about ever using the other utilities ? I looked at the man page; it is quite detailed. However, learning this language requires a non-trivial effort and I would like to get some input from experienced users before I change directions. As a start, can anyone mail me the perl translations of the following scripts ? If anyone wants to respond, it would help if you put comments which described what a given line does. This will help me learn perl and decide if I should switch to using this language. --------------------------------------------------------------------- #!/bin/sh -v # Copy selected files to a backup directory for project quant. No # arguments required. QUA=/usr/alta/edm/jones/quant if [ ! -d $HOME/Bak_quant ];then mkdir $HOME/Bak_quant fi # find files which do NOT match files in the name-list; do not descend # into the /usr/alta/edm/jones/quant/inc directory for f in `find $QUA ! \( -name "Makefile" -o -name "Makefile.bak" \ -o -name "lib*.a" -o -name "quant" -o -name '*.o' \) \ -print -name inc -prune | sed '1d'` do cp -r $f $HOME/Bak_quant/ done ) & --------------------------------------------------------------------- A perl script needed to put single quotes in the hex numbers in a Fortran DATA statement of the form DATA A,B, /3, Z0F/, C, D, E, C /ZABC012, 10.0, ZFFF/ The DATA statement has 1 or more lines and all lines have spaces/tabs at the beginning. If a line is a continuation of the previous line, there is a character in the 6th column/field. There are many other lines of code in the program; this operation needs to be done only one the lines beginning with ^[ TAB]*DATA (line-type 1) OR lines following line-type 1 and having ANY character in column/field 6 (line-type 2). A line type 2 may have spaces/tabs between the character in column/field 6 and the following characters, if any OR line-type 2's following other line-type 2 lines Thus, the above should generate DATA A,B, /3, Z'0F'/, C, D, E, C /Z'ABC012', 10.0, Z'FFF'/ --------------------------------------------------------------------- Thanks in advance for the responses, folks. Jimmy Mason jimmy@cs.UAlberta.CA -- jimmy@cs.UAlberta.CA