Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
And want to get it into this form:a b c 0 0 d 0 1 d 0 1 d 0 2 d 0 2 d 1 0 d 1 0 d 1 1 d 1 1 d 1 2 d 1 2 d
I thought it would be easy to just load it into a hash and then be able to reprint it to a different file but it is not working since I can't figure out how to start back up at the top of a new column. This is what I have printing into one column:a b c a b c 0 0 d 1 0 d 0 1 d 1 0 d 0 1 d 1 1 d 0 2 d 1 2 d 0 2 d 1 2 d
I would appreciate any ideas for doing this effectivly.foreach my $va (sort {$a <=> $b} keys %myhash) { foreach my $vb (sort {$a <=> $b} keys %{ $myhash{$va} }) { my $vc = $myhash{$va}{$vb}; print OUTFILE "$va\t$vb\t$vc\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: text formatting in columns with hash?
by toolic (Bishop) on Jul 03, 2013 at 19:46 UTC | |
by BillKSmith (Monsignor) on Jul 03, 2013 at 19:54 UTC | |
|
Re: text formatting in columns with hash?
by Loops (Curate) on Jul 03, 2013 at 20:09 UTC | |
by Anonymous Monk on Jul 05, 2013 at 20:25 UTC | |
|
Re: text formatting in columns with hash?
by 2teez (Vicar) on Jul 03, 2013 at 19:57 UTC | |
|
Re: text formatting in columns with hash?
by poj (Abbot) on Jul 03, 2013 at 19:45 UTC |