Non french-speaking people, skip the first section of this document, the rest is in english

Pour les français: une introduction à perl

J'ai écrit pour un cours en 1997 un document d'introduction, que vous pouvez télécharger d'ici. Tous les commentaires et critiques sont les bienvenus.

Ce document peut être reproduit, imprimé et distribué librement pour une utilisation non lucrative, tant que l'auteur original en garde le crédit.

Et quelques pointeurs sur les documents de base servant de point de départ à l'utilisation de perl.

Some perl scripts

Here are some of the perl scripts I wrote some years ago.


clean 4.57 : This programs cleans your account by deleting and compressing the files, according to a regexp and a limit age in days. It can also apply strip to the files that need it, and many other things. There is a bunch of options, that are all explained in the man page (in english).
You can customize the actions (which files to delete, to compress, set default options, protect some directories, ...) by editing a file ( .cleanrc). This file is automatically generated the first time you run the program. Maybe you'd want to see an example of this config file.

Note: the script builds the code for the loop that examines all the files in the specified tree, so the code is absolutely unreadable. To see the generated code, run clean -C.

Some tips: Type clean -h to get some help. Type clean -o to see which files are to be deleted/compressed and the state of options.

Something new: when you type clean -cf, the script will only check for the files to be deleted and compressed, and put the list into the file ~/.clean-history (that's not new). You can the edit the ~/.clean-history file to remove for instance the files that you do not want to delete and invoke clean -pf, which will actually do the actions suggested in the file, ie will actually delete the files specified in the .clean-history file. It is faster, and allows you to choose what files are to be deleted or compressed.

Here are the pointers to : : generation of transparencies (that some yuppies call slides) from a single HTML source file. A template is given at the end of the script.


csh2sh : csh to sh converter. Two versions of this script are available here: my old version which works alright for me, and an derived version by Bob Arnold. Bob's version handles more features and is very powerful. It uses another script from Bob: fmt.script. But I keep my version around, to be able to modify it if needed.

autodoc : Automatic generation of documentation for perl scripts. Actually, this script only extracts comments and function parameters. It can be useful.


alias2html : This programs converts the sendmail aliases file to HTML format. It splits the list in many categories, and makes some links here and there...
To use it, you have to customize it a little bit :

One file is produced for each category. To declare a category, it must be a comment, starting with one or two #, followed by one or more spaces, and then the category name. For instance :

# Category name

cgrep - Contextual grep : A useless script if you've got the GNU version of grep (I'll RTFM longer next time) which greps a string and prints it with some lines of leading and trailing context. Simple minded, rather meant as an example.