in reply to missing package or object reference
I think you meant:
... my $lineNum = 1; while ( my $hr = $csv->getline_hr(*FILE) ) { my $sku = $hr->{ 'sku' }; print "$sku\n"; $lineNum++; }
The getline_hr() method - just as the underlying getline() - expects an IO object (Perl file handle), not a string.
To parse lines directly from strings, you'd say $csv->parse($line) — but there's no parse_hr() method (you don't need it for what you're doing, as the above should work fine).
(When using $csv->getline_hr($line), I do get the exact same error.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: missing package or object reference
by NetWallah (Canon) on Dec 23, 2011 at 22:27 UTC | |
by joeorozco316 (Initiate) on Dec 27, 2011 at 16:13 UTC |