Hi Sunita,

Please find the code snippet here:

@array = qw(1 2 3 4 5 4 3 2);
foreach (@array){
            $myhash{$_} = $myhash{$_} + 1;
             }
while(($s,$k) = each(%myhash)){

          push @res,$k;
}
       print "Array in unique is : @res\n";

Regards,
Jitendra

On Thu, Nov 26, 2015 at 10:46 PM, Mike Flannigan <mikef...@att.net> wrote:

>
> See if this meets your needs:
> http://www.arl.wustl.edu/projects/fpx/references/perl/cookbook/ch04_07.htm
>
>
> Mike
>
>
> On 11/25/2015 1:53 AM, beginners-digest-h...@perl.org wrote:
>
>
>
>
>
> Hi
>
> I want to create a unique array .
>
> I have the code below. It is creating a array which will have duplicate
> data . How can I filter duplicate data ?
>
> #!/usr/bin/perl
>
> use Data::Dumper;
>
>
>
> #my $cnt = scalar @$net_int_parsed_output; $net_int_parsed_output = [lif_1
> ,lif_2,lif_3,lif_4,lif_1,lif_2]; foreach my $n (@$net_int_parsed_output){
>
>         my $lif_cnt++;
>
>         print "lif of vserver >>> $n\n";
>
>                 push
> (@{$lun_PR_resv_info->{'lun'}->{'vserver'}->{'fcp_lifs'}},$n);
>
> }
>
>
>
> print "lun PR resv related info>>>>>>>>>>>>>",Dumper
> $lun_PR_resv_info,"\n";
>
>
> Thanks
>
> Sunita
>
>
>


-- 
Regards,
Jitendra

Reply via email to