Platform-Specific Perl

in Perl Tips, Files & Directories
by William Ward on October 2, 2006 8:29 pm

As an interpreted language, Perl scripts can generally be run unmodified on any platform. But there are situations where the differences between platforms make it necessary to test what platform you are running on and act accordingly. (more…)

Finding the Largest File in a Directory

in Perl Tips, Files & Directories
by William Ward on February 22, 2005 5:31 pm

Here’s an easy way to find the largest file in a directory.

(more…)

Modifying a File Without Changing Its Timestamp

in Perl Tips, Files & Directories
by William Ward on October 25, 2004 3:51 pm

Your file system keeps track of when each file was last modified. But have you ever wanted to edit a file without affecting its timestamp? Using the "utime" function, which is built in to Perl, you can! Here’s how:

(more…)

Writing Configuration Files in Perl

in Perl Tips, Files & Directories
by William Ward on July 17, 2003 1:00 am

It is often useful to have a configuration file for a program, where you can specify certain variables that are used in the program. Examples of configuration parameters might include files, email addresses, usernames, or passwords the program uses, etc. If your Perl program needs to read a configuration file, there are lots of ways to do it.

(more…)

Input Delimiter

in Perl Tips, Files & Directories
by William Ward on July 29, 2002 3:41 pm

Normally, reading from a file is done one line at a time. But sometimes that is not very convenient. What if you want to read in text one paragraph at a time? Or maybe your data is separated by TAB characters rather than newline characters?

(more…)