Re: file renamer (i'm a newbie)
"Eric Waguespack" <[email protected]> Sat, 25 Mar 2006 00:56:21 -0600
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
ok...
#!/usr/bin/perl -nl
$o=$_;y/ /_/;-e||print("renaming $o ===> $_")&&rename$o,$_
ok so you are looping around <> and adding newlines...
saving the name as $o
y is an alias for tr
checking if the file exists with -e
|| print msg && rename.
very nice, thanks a lot.