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); }

thanks for the hints, and are there any idears how to amke this code a bit nicer ?
i don't like this @tmp pushing everything in there removing the duplicates

kd ultibuzz


In reply to Re: Simple Table structure to file by ultibuzz
in thread Simple Table structure to file by ultibuzz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.