If you want to learn by experimenting, remember that a string and an array are very different data structures. Tie::File gives you an array of strings, but you treat it like an array of arrays (containing strings). Perl constructs arrays of arrays as arrays containing array references. See perldsc. Use Data::Dumper to see what your data actually looks like.
If you just want to solve the original problem, don't parse CSV manually, use Text::CSV_XS to get your data in a format that you can work with. Consider using DBI and DBD::CSV instead for an even shorter way (the SQL INNER JOIN proposed by locked_user sundialsvc4) to read AND combine AND export your data. Note that the DBI way also allows to migrate the program to SQLite or any other database in a later version.
Unless you know your CSV files in every single detail, and especially unless you are absolutely sure that they don't contain nasty things like optional quotes, quoted separator chars, escaped quotes, newlines in data, NULLs, binary data, and so on, you better AVOID split and use Text::CSV_XS. split alone can't handle any of those problems, Text::CSV_XS can handle all of them.
Alexander
In reply to Re^5: load a file in memory and extract parts
by afoken
in thread load a file in memory and extract parts
by healingtao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |