Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Get unique fields from file

by sroux (Acolyte)
on Jan 06, 2022 at 09:22 UTC ( #11140211=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %combined;
    open(my $input, "<", "flatfile.dat") or die ("Unable to open file");
    my $line = <$input>;
    ...
            push( @{ $combined{$header} }, shift(@row) );
        }
    }
    
  2. or download this
    #Remove duplicates
    my %seen = ();
    my @uniqueOutput = grep { ! $seen{ $_ }++ } @output;
    print $fh3 @uniqueOutput;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11140211]
Approved by marto
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-08-10 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?