Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: opening a file

by choroba (Canon)
on Jun 13, 2013 at 14:19 UTC ( #1038749=note: print w/ replies, xml ) Need Help??

in reply to opening a file

There are several issues:

  • 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.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Comment on Re: opening a file
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038749]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2015-11-30 19:58 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (779 votes), past polls