#!/usr/bin/perl # From: Dean Gaudet # # i didn't write this... it's from some perl book. but it's so bloody # useful it's frequently the first script i end up copying whenever i # move my environment. # # Usage: rename perlexpr [files] ($op = shift) || die "Usage: rename perlexpr [filenames]\n"; if (!@ARGV) { @ARGV = ; chop(@ARGV); } for (@ARGV) { $was = $_; eval $op; die $@ if $@; rename($was,$_) unless $was eq $_; }