There are several issues:
in reply to opening a file
- After reading from the standard input, the line ends in a newline. This newline is not a part of the filename, so remove it. See chomp.
- Why do you declare the variable $file_csv? Its value is identical to $csv_name (the space after the $ sigil is tolerated by Perl, but I would recommend removing it).
- You are closing the FILE filehandle, but opening the FILE_csv one. If you turned warnings on, Perl would tell you.
- Update: It is easier to send lexical filehandles as parameters to subroutines. Do not use bareword filehandles.