On Sun, Nov 29, 2015 at 03:30:53PM +0530, Pritish Pattanaik wrote:
> *Remove duplicate elelments from an array, It will maintain the original
> order*
>
> __CODE__
> @array = qw(11 2 3 4 55 4 3 2);
> %hash = ();
> for(my $i=0;$i<=$#array;$i++){
> # store the position from array. use array ele
Hi Jitendra,
some comments on your code:
On Sun, 29 Nov 2015 13:09:42 +0530
Jitendra Barik wrote:
> Hi Sunita,
>
> Please find the code snippet here:
>
> @array = qw(1 2 3 4 5 4 3 2);
You are missing "use strict;", "use warnings;" and "my" declarations here:
http://perl-begin.org/tutorials/
Hi,
*Remove duplicate from an array using hash, It will disorder the original
position of an array *
__CODE__
my @array = qw(11 2 3 4 55 4 3 2);
my %hash;
map { $hash{$_}++ } @array;
@array = keys %hash;
print "Array:@array\n";
__END__
*Remove duplicate elelments from an array, It will main
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 a
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
Hi Sunita,
On Wed, 25 Nov 2015 13:23:24 +0530
Sunita Pradhan wrote:
> Hi
> I want to create a unique array .
You probably mean an "array with unique elements". To do so, you should use a
hash. See:
http://perl-begin.org/topics/hashes/
> I have the code below. It is creating a array which wi
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];