title: Error while trying to rename files in script and cmd line
body: <pre><code>$dir = "/home/naveen/mp3tag/testfolder";
  opendir(DMP3, $dir) || die("Cannot open directory");
  @files= readdir(DMP3;
  foreach $f (@files)
  {
    unless ( ($f eq ".") || ($f eq "..") )
    {
      $oldfile = $f;
      $newfile = $f;
      $newfile =~ s/ /_/g;
      print "Old file: $oldfile \t";
      print "New file: $newfile";
      print "\n";
      rename ("$oldfile", "$newfile") or warn "Couldn't rename $oldfile to $newfile !\n";
    } 
  }
  </code></pre>
  
  <p>I'm writing a simple program to add underscores to an existing file and rename it. This is how far ive gotten with the code. However its not able to rename the file and gives me a warning and i'm not sure where the mistake is. </p>
  
  <p>Also when i tried the same line on the cmd line I get the following error msg.</p>
  
  <pre><code>$ rename Jacques\ Greene\ -\ Clark\ \(Original\ Mix\).mp3 JG - C.mp3
  Bareword "mp3" not allowed while "strict subs" in use at (eval 1) line 1.
  
  $ rename Jacques\ Greene\ -\ Clark\ \(Original\ Mix\) JG - C
  Can't locate object method "Original" via package "Mix" (perhaps you forgot to load "Mix"?) at (eval 1) line 1.
  </code></pre>