I have a script that uses Text::CSV to build a HoH structure from a CSV file. The script stopped at the last line of the following code:
# snippet of the code sub buttons { my $csv_file = '/home/user/mydomain.com/cgi-bin/files/spreadsheet.csv' +; my $csv = Text::CSV->new ( { allow_whitespace => 1, binary => 1, sep_c +har => '|' } ) or die "Cannot use CSV: ".Text::CSV->error_diag (); my $csv_fh; open ($csv_fh, "<:encoding(utf8)", $csv_file) or die "$csv_file : $!"; $csv->column_names($csv->getline($csv_fh));
Here's the error that I found in the error logs:
[error] [client 66.200.100.66] sv_upgrade from type 8 down to type 6 +at myscript.pl line 672, <$csv_fh> line 1.
Line 672 is the column_names line above. Perl version 5.10.0 I recently appended a couple lines to the spreadsheet.csv file. I took a look at the docs, but I'm in over my head here. Any hints appreciated. The rest of the sub follows
my @buttons; while (my $row = $csv->getline_hr($csv_fh)) { push(@buttons, $row) unless ($. == 1); } my %buttons_hash = ""; for my $button (@buttons) { my $this_item_name = ${$button}{item_name}; ${buttons_hash}{$this_item_name} = $button; } return \%buttons_hash; }

In reply to sv_upgrade error by wrinkles

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.