This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0 patch #9 (combined patch)
[perl5.git] / eg / rename
CommitLineData
a687059c
LW
1#!/usr/bin/perl
2
3($op = shift) || die "Usage: rename perlexpr [filenames]\n";
4if ($#ARGV < 0) {
5 @ARGV = <stdin>;
6 chop(@ARGV);
7}
8for (@ARGV) {
9 $was = $_;
10 eval $op;
11 die $@ if $@;
12 rename($was,$_) unless $was eq $_;
13}