Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: remove duplicate value in array

by Anonymous Monk
on Jul 03, 2015 at 11:54 UTC ( [id://1133080]=note: print w/replies, xml ) Need Help??


in reply to Re: remove duplicate value in array
in thread remove duplicate value in array

@content = qw(1 2 3 1 2 4 2 5 4 3); print "arr @content\n"; for ($i=0; $i<=$#content; $i++) { my $count = 0; for ($j=$i+1; $j<$#content+1; $j++) { if ($content[$i] == $content[$j]) { $count++; } if ($content[$i] == $content[$j] && $count == 1) { $content[$j] = ""; } } } print "@content";

Code tags added by GrandFather

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1133080]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found