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
    Eliya++

    I independently came to the same solution after reviewing this node, and confirm that it works.

                "Battle not with trolls, lest ye become a troll; and if you gaze into the Internet, the Internet gazes also into you."
            -Friedrich Nietzsche: A Dynamic Translation

      Thank you this worked.