$ touch ABC\ 435535.doc $ touch DEF\ 985535.doc $ touch GHI\ 125535.doc $ ls 632437.pl ABC 435535.doc DEF 985535.doc GHI 125535.doc $ perl -l 632437.pl $ ls 125535.doc 435535.doc 632437.pl 985535.doc $ cat 632437.pl use strict; use warnings; use File::Copy; while(<DATA>) { my $from = $_; chomp $from; (my $to = $from) =~ s/.* //g; move($from, $to) or die(qq{failed to move $from -> $to}); } __DATA__ ABC 435535.doc DEF 985535.doc GHI 125535.doc
In reply to Re: Simple Perl file rename
by andreas1234567
in thread Simple Perl file rename
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |