array uniq elements
- From: chrisstinemetz@xxxxxxxxx (Chris Stinemetz)
- Date: Sun, 8 Jan 2012 23:15:18 -0600
How do I extract uniq elements from an array? Basically I want to
preserve the order of the elements as they are first seen, but I would
like to remove any duplicates.
Below is what I have so far.
Thank you in advance.
Chris
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
my @header;
while( <DATA> ) {
chomp;
if($_ =~ /(.*)\=(.*)?/) { will use $2 for later.
@header = $1;
print Dumper \@header;
}
}
__DATA__
csno=1rfpi=1
vrp0=3423000
vrp1=3423000
trl=1700000
low=
high=5
csno=1rfpi=2
vrp0=3423000
vrp1=3423000
trl=1700000
row[1]=
row[2]=
row[3]=
line=
low=
high=5
csno=1rfpi=3
vrp0=3423000
vrp1=3423000
trl=1700000
line=
low=
line[1]=
line[2]=
high=5
low=
.
- Follow-Ups:
- Re: array uniq elements
- From: Jim Gibson
- Re: array uniq elements
- From: Robert Wohlfarth
- Re: array uniq elements
- Prev by Date: Re: files checksum perl program help
- Next by Date: Re: array uniq elements
- Previous by thread: Appending extra characters to file name
- Next by thread: Re: array uniq elements
- Index(es):