>
> Hi, all.
>
> I need to print a header line without duplicated item and am
> struglling with
> the elimination of replicated items.  The following codes are nor
> working
> yet.  Could anyone help me to make this work?

As someone pointed me to:

perldoc -q duplicate

HTH,

Steve


>
> #!usr/bin/perl
>
> use strict;
> use warnings;
>
> my @header;
> my $i ;
> my $size = @header;
>
>
> while (<DATA>) {
>   if (/Type/)
>       {
>       @header = split(/\t/, $_);
>       print $_;
>       for ($i=1; $i<= $size; $i++)
>               {
>               if (my @item[i] ne @item[i+1])
>               {pirnt $item[i+1];}
>               }
>       }
>   }
>
>
>  __DATA__
>  Type HF      HF      HF      HF      LY      LY      LY
>  [snip]
>
>  Output should be
> Type  HF      LY
>
> Thanks,
>
> Aiguo
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to