Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Thursday, January 31, 2008

Convert ADCIRC grid to Tecplot data file

I created this utility to convert ADCIRC compatible grids in to Tecplot files. The program is written in Perl. I also added comments. If you need it, enjoy :). If you want to see the code it self you can look at this file.

Wednesday, January 16, 2008

Mass substitution with Perl Command Line

For changing all occurrences of a several expression in a file, Perl with command line options can be very helpful. The following shows a pretty general example:

$> perl -i.bck -ep 's/search_term/replace_with/g' filename

The above command will check the "filename" file and, replace all occurences of "search_term" with the "replace_with" term. "-i" option tells Perl to backup the file with a ".bck" extension before any operation.

Monday, January 07, 2008

Manually install Perl modules with CPAN.pm

From your shell run

$> perl -MCPAN -e shell

command, it will ask you a few questions. Answer the questions, which are the basic settings for the local installation directory. You can set it up to a local directory within your home directory. Then simply type the following to install any module.

$> install Date

will install the latest Date module for Perl.

For further details see CPAN web site