in reply to printing output on text file from file - perl
What you call a hash actually seems to be at least one array of arrays. And giving us a dump of your datastructure is a good idea, but it works better if you pass a reference (by adding \ in front of your variables) rather than the hash or array directly. In your case that would probably be something like :
or if you actually have a hash: print Dumper \%hash; this will ensure that your list or hash element is transmitted whole, and not flattened into several arguments.use Data::Dumper; my @array = somecode(); print Dumper \@array;
I'd add perldsc to mtmcc's answer, to obtain a better understanding of Perl data structures. And most of times in Perl, you don't have to use indexes to iterate through an array, you can just write
.for my $element (@f) { my $key = $element->[0]; ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing output on text file from file - perl
by Perlseeker_1 (Acolyte) on Oct 15, 2013 at 16:24 UTC |