use strict; my $file = '.'; opendir(MYDIR,$file); my @files = readdir(MYDIR); foreach $_ (@files) { next if($_ =~ m/^\.+$/); if ( m/ /g ) { my $oldfile = $_; s/ /_/g; if (! -e $oldfile) { rename $oldfile, $_; } else { print "Could not rename $_ because $oldfile na +me already exists and can not be overwritten\n"; } } print "$_\n"; }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |