I have been editing a small script to get the hashes to work for a larger script. So far, I have been getting the error: Reference found where even-sized list expected at ./idv1csv line ---. The "---" represents one of many lines. This script retrieves MP3 information and outputs the hash/value pairs to the screen. Or is supposed to. When running without warnings or strict, it happily produces empty hashes and clean output (wrong). I placed a lot of debugging in the script, but here is what I have:
#! /usr/bin/perl # (above should be "perl -s" for parameters) use strict; use warnings; use MP3::Info; foreach my $file (`ls *.mp3`) { chomp $file; print "$file\n"; my %info = get_mp3info($file); my %tags = get_mp3tag($file); foreach my $key (keys %info) { my $value = $info{$key}; print __LINE__, "\t $key = $value\n"; } print __LINE__, "\t Time: $info{TIME}\n"; foreach my $key (keys %tags) { my $value = $tags{$key}; print __LINE__, "\t $key = $value\n"; } print __LINE__, "\t Title: $tags{TITLE}\n"; }
The output on a console looks like this for one MP3 file:
02_-_Too_Close_To_The_Sun.mp3 Reference found where even-sized list expected at ./idv1csv line 12. Reference found where even-sized list expected at ./idv1csv line 13. Use of uninitialized value $value in concatenation (.) or string at ./ +idv1csv line 17. 17 HASH(0x600070340) = Use of uninitialized value $info{"TIME"} in concatenation (.) or strin +g at ./idv1csv line 19. 19 Time: Use of uninitialized value $value in concatenation (.) or string at ./ +idv1csv line 23. 23 HASH(0x6001cb690) = Use of uninitialized value $tags{"TITLE"} in concatenation (.) or stri +ng at ./idv1csv line 25. 25 Title:
ANy help as to why I get this error (Reference found where even-sized list expected) is appreciated. That might help me figure out the other errors, if there is any left.

In reply to Reference found where even-sized list expected by sciguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.