When reading an array (actually an array of arrays) from a hash table, there seems to be an extra level in the data structure. I fill the array from a file as such.
open(my $fh, '<', $newfile) or next;
while (my $line = <$fh>)
{
my @job = split /\s+/, $line;
push @userjobs, [ @job ];
}
close ($fh);
userjobs has a size of three as expected, from the file, and I add it to the %crontab hash
$crontab{$user} = [ @userjobs ];
When I attempt to read the user jobs back the size is 1
my @temp = $crontab{$user};
Looking at Dumper shows an extra level in the hash table value hierarchy. I can access the hash table through something like $crontab{$user}[0][0]. However, now I want to add a 4th userjob, but I can't access the underlying job array. Adding push @temp, [ @newjob ] adds it to the additional level, but not the job array. Any idea what I'm doing wrong?
push @userjobs, \@job;- push into array reference to another array (@job)?%crontabyou have generated -- post output so we knew what you deal with.