perl
Categories:


#!/usr/bin/perl
# rexname - Larry's filename fixer
#
# Modified by Brian Mathis to add testing and verbose
#
use strict;
use Getopt::Long;

my $usage = < Usage:
rexname expr [files]
rexname --test expr [files]
rexname --verbose expr [files]

Options:
--test (-t)
Don't actually do anything (implies -v)

--verbose (-v)
Display output of changes as they are made
USAGE

my($test, $verbose);
GetOptions("test" => \$test, "verbose" => \$verbose);
if($test) { $verbose = 1; }

my $op = shift or die $usage;
chomp(@ARGV = ) unless @ARGV;
for (@ARGV) {
my $was = $_;
eval $op;
die $@ if $@;
print "$was \t-> $_\n" if $verbose;

Categories:

Notes on how to do some things in Perl.