#!/usr/bin/perl use strict; use warnings; my $f = shift; if ($f =~ m[^s/]) { $f = eval "sub { $f }"; } else { my $re = qr/$f/; my $to = shift; $f = eval "sub { s/\$re/$to/ }"; } for (@ARGV) { my $o = $_; $f->(); if ($o ne $_) { if ( ! -e $o ) { print "rename $o, $_\n"; rename $o, $_; } else { print "can't rename : $o exists\n" } } }
In reply to Re^2: Yet another perl-rename tool
by wazoox
in thread Yet another perl-rename tool
by Tanktalus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |