in reply to Filehandles and CSV_XS
<DATA> is not a filehandle, it's the <> I/O operator (aka readline) applied to the bareword filehandle DATA. $csv->getline(DATA) may work in your code because you don't have strict turned on (which can cause strange and hard-to-analyze bugs), but since you should always Use strict and warnings, you should use the glob notation to pass bareword filehandles as arguments, i.e. $csv->getline(*DATA). For files you open, nowadays you should always use lexical filehandles - "open" Best Practices.
Minor edits shortly after posting.
Update in response to your edit: Relevant reading is Symbol Tables, Typeglobs and Filehandles, and Passing Symbol Table Entries (typeglobs) (and perlref for globrefs).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Filehandles and CSV_XS
by Melly (Chaplain) on Sep 01, 2023 at 10:55 UTC | |
by eyepopslikeamosquito (Archbishop) on Sep 01, 2023 at 13:09 UTC | |
by NERDVANA (Priest) on Sep 02, 2023 at 06:50 UTC |