in reply to Hash of arrays.. can't shift on derefferenced array
Are you sure you're actually getting the result you think you're getting? Specifically, it really sounds like the line number should correspond to your print "$item"; line. And "Use of uninitialized value in string at..." is a warning, not an error (unless you're doing something strange). I'd suggest that you look at what exactly is in your hoa before the loop. Here's test code that works just fine.
which produces as output#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hoa = ( a => ["apple", "aardvark"], b => ["banana", "bandana"], ); foreach my $head (keys %hoa) { my @data = @{$hoa{$head}}; my $item = shift(@data); print "$item,"; } print $/;
apple,banana,
|
---|
In Section
Seekers of Perl Wisdom