D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] programming question



On Tue, Mar 26, 2002 at 09:20:50AM +0000, MATTHEW BROWNING wrote:
Perl is mostly the best tool for the job :)

Hmm, I'm getting quite partial to TCL, mainly because if I really get
stuck trying to construct an expression, I can play around in interactive
mode (tclsh) until it works.

Another interesting thing is that strings inside {} are left unsubstituted,
even internal pairs of {}'s are left alone. This is useful for outputting
chunks of Latex without having a zillion "leaning toothpicks" (escaping
all the {}\). If you do need to substitute the value of a variable etc you 
can use a dummy string and substitute afterwards with regsub eg
...
set header { ... yards of Latex here ... ##TITLE## ... }
regsub {##TITLE##} $header $titlestr header
puts $OUTFILE $header
...

Resist, resist!

"Resistance is useless!"

I do that in Perl all the time; invoke Perl at the command line and 
press ctrl-d when you are done with your expression to see how it 
evaluates.

Alternatively, type `perl' followed by the expression if it is a 
one-liner.

Many thanks

If you find this way of working useful, Python makes quite a big deal 
out of its interactive mode, which alerts you of invalid statements 
as you go along. (It also has loads of fabby modules to play with).

I've kept clear of Python so far, is there anything in particular that
it's supposed to be especially good for, or is it just all down to taste?

KAM




--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly