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=1
rfpi=1
vrp0=3423000
vrp1=3423000
trl=1700000
low=
high=5

>csno=1
rfpi=2
vrp0=3423000
vrp1=3423000
trl=1700000
row[1]=
row[2]=
row[3]=
line=
low=
high=5

>csno=1
rfpi=3
vrp0=3423000
vrp1=3423000
trl=1700000
line=
low=
line[1]=
line[2]=
high=5
low=

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to