[lug] Perl question

Evelyn Mitchell efm at tummy.com
Fri Mar 31 14:58:17 MST 2000


On Fri, Mar 31, 2000 at 02:41:26PM -0700, Bob Collins wrote:
> 
> rename 'tr/A-Z/a-z/ unless /^Make/' *

This means translate all characters from upper to lower except for
those that match Make<something>
I assume this example was designed to be used with program files
where the directory contains a Makefile (case sensitive).
Funny, they don't explain this.

> I watch it step throug with no errors.  The script terminates without
> changing anything because $was is equal to $_.  Which it is set to in
> the script.

If you don't have a file named Make<something> in the directory,
the unless clause will never get triggered.

> This script is attributed to Larry Wall, but I think something must be
> missing or incorrect in the script.

Well, he did write trn, which he admits he left in pieces on the floor.
Check the source for it someday.

Evelyn

-- 
http://www.tummy.com/ Consulting and Software for Linux and Unix
KRUD - Kevin's Red Hat Uber Distribution - the Freshest Red Hat every month




More information about the LUG mailing list