physi has asked for the wisdom of the Perl Monks concerning the following question:
List 100:
W01 625 Z01 WWGZU Q19 0.343
S02 W222G02 XXXX9 B11 Mr.
G03 uu 1 Adams
This has to be converted into :
W01 625 Z01 WWGZU Q19 0.343 S02 W222 G02 XXXX9 B11 Mr.|Adams G03 uu 1So my idea was to take one whole list, put it into an $hash->{col}->{row} hash, and took out all the defined tags by there coordinates. This works, but it's a bit slow. The hash-filling took a lot of time, I guess:
But maybe there is a much better way for this kind of task, or even a cpan-module?my $line = 0; while (<FILE>) { my @linesplit = split //, $_; my $i = 0; for my $column (@linesplit) { $list->{$line}->{$i}= $column; $i++ } $line++; }
----------------------------------- --the good, the bad and the physi-- -----------------------------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting from a File
by tadman (Prior) on May 15, 2002 at 17:18 UTC | |
by physi (Friar) on May 15, 2002 at 17:32 UTC | |
by tadman (Prior) on May 15, 2002 at 18:02 UTC | |
by physi (Friar) on May 15, 2002 at 18:54 UTC |