[EMAIL PROTECTED] writes:

>   I was going to take you up on this, but the Perl code would so closely
> match the shell code that it would be uninteresting.  If I think of a neat
> way to abuse the idea, I'll post it (assuming Kevin Clark doesn't beat me
> to it).  ;-)

(I use this all the time)

>From the Pink Camel Book:

#!/usr/bin/perl

# rename script examples
#       rename 's/\.orig$//' *.orig
#       rename 'y/A-Z/a-z/ unless /^Make/' *
#       rename '$_ .= ".bad"' *.f
#       rename 'print "$_: "; s/foo/bar/ if <stdin> =~ /^y/i' *

# Usage: rename perlexpr [files]

($op = shift) || die "Usage: rename perlexpr [filenames]\n";
if (!@ARGV) {
    @ARGV = <STDIN>;
    chop(@ARGV);
}
for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was,$_) unless $was eq $_;
}


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to