Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Get unique fields from file

by sroux (Sexton)
on Jan 06, 2022 at 09:22 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found