sueme has asked for the wisdom of the Perl Monks concerning the following question:
Except that I intend to replace the print with an appropriate rename line. I was wondering if there was some kind of one liner that would accomplish the same thing or a neater way of doing it?my @files = <*.mp3>; for my $file (@files) { my $file2; ($file2 = $file) =~ s/^(..).*/$1_my_guitar.mp3/; print $file . " " . $file2 . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: renaming files
by Eliya (Vicar) on Dec 15, 2011 at 22:56 UTC | |
|
Re: renaming files
by graff (Chancellor) on Dec 16, 2011 at 03:49 UTC | |
|
Re: renaming files
by TJPride (Pilgrim) on Dec 16, 2011 at 16:33 UTC | |
by discofris (Initiate) on Mar 04, 2012 at 17:45 UTC |