http://www.perlmonks.org?node_id=11121054


in reply to Re: rename file
in thread rename file

Update - added $ to lexical file handle I added to the script.

I'm not sure if the quotation applies to the
    open ( $UPLOADFILE, ">", $upload_dir/$fileto" ) or die "$!";
statement or not, but if it does, please be aware that a sigil does not a lexical make.

Strictures are not enabled in the code here, so $UPLOADFILE just autovivifies a package-global scalar filehandle where UPLOADFILE would have been a package-global bareword filehandle. For a true lexical, use my:
    open ( my $UPLOADFILE, ">", $upload_dir/$fileto" ) or die "$!";
Of course, the script in question is short enough that lexical-versus-global filehandle won't make any practical difference.


Give a man a fish:  <%-{-{-{-<