in reply to Simple Table structure to file
after smathing and throwing some office stuff the blockade is gone and i managed to code somthing that is working but is far away from being nice code
#!"C:\perl\bin\perl.exe" use warnings; use strict; open(IN, '<', "traffic_compare.txt") or die("open failed: $!"); my @tmp; while (<IN>) { chomp; push @tmp,(split(';',$_))[0]; } close(IN); my @tmp_new= do { my %seen;grep !$seen{$_}++, @tmp }; my %table_hoa; foreach my $groups (@tmp_new) { open(IN, '<', "traffic_compare.txt") or die("open failed: $!"); while (<IN>) { (my $id, my $value) = split(';',$_); if ($id == $groups) { push @{ $table_hoa{$groups} }, $value; } } close(IN); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simple Table structure to file
by davorg (Chancellor) on Jan 23, 2007 at 10:48 UTC | |
|
Re^2: Simple Table structure to file
by virtualsue (Vicar) on Jan 23, 2007 at 10:42 UTC |