Referencing Perl

This blog is created to share perl resources all round the world and to explore the same.

Name:
Location: Chennai, TamilNadu, India

A Computer Freak, interested in programming open source

Wednesday, March 30, 2005

Removing Duplicates from Array


my @array = qw/1 2 3 4 1 2 3 4/;
%temp = ();
map{$temp{$_}++}@array;
for (sort keys %temp) {
print "$_=>$temp{$_}"."\n";
}
--prasanna.k

31 Comments:

Anonymous Harish.H said...

This Does the Job Easily I Think

@arr = ("1","2","1","1");

@arr2 = grep { !$count{$_}++ } @arr;

print @arr2;

7:08 AM  
Anonymous Anonymous said...

personally im not a huge fan of map in void context. Also if you are going to have a temp hash you might as well squirel it away in a lexical block.

my @deduped = do{ my %dupe; grep !$dupe{$_}++, @hasdupes };

demerphq

3:57 AM  
Anonymous Anonymous said...

I was going to say the same as demerphq about making your variables lexically-scoped instead of globals. Have you tried running your code with "use strict" and "use warnings"? Do you run -any- of your code with "use strict" and "use warnings"?

As soon as you do, you'll start getting lots of errors. You can get rid of a lot of them (or even all of them) by using "my" in front of your variables. Otherwise, you're giving implicit bad advice to the people who read this page!

liverpole

5:58 AM  
Anonymous Anonymous said...

I would like to do similar, but instead I want to print the duplicates so that the end user may know what they were.

(rather than remove them)

2:52 AM  
Anonymous Anonymous said...

Prescriotion Drug Yi Quit Smoking
http://www.foodfashionofindia.com/ - propecia price
However, these symptoms usually do not last long, and disappear when you stop medication.
[url=http://www.foodfashionofindia.com/]cheap propecia online[/url]
Seek immediate medical help if you experience any of these problems.
propecia drug
Propecia - Hair loss treatmentFDA-Approved Medications
No Prescription is Needed
Free Shipping for Bulk Orders
15% Discount on Reorders Buy low cost Propecia (Finasteride) drugs at one of reliable online pharmacies and save big!
Propecia is a popular and effective medicine for treating male pattern hair loss.

2:16 AM  
Anonymous Anonymous said...

I am the sort of guy who loves to taste unused things. Currently I'm fabricating my own photovoltaic panels. I am doing it all by myself without the aid of my men. I am utilizing the internet as the only path to acheive that. I saw a truly amazing website that explains how to build photovoltaic panels and so on. The place explains all the steps needed for solar panel construction.

I'm not really sure about how precise the data given there iz. If some experts over here who have xp with these things can have a peak and give your feedback in the site it will be grand and I would highly treasure it, cause I really take an interest in solar panel construction.

Thanks for reading this. You people are great.

2:53 PM  
Anonymous Anonymous said...

Keep working ,great job!

8:15 AM  
Anonymous Anonymous said...

married and dating [url=http://loveepicentre.com/]yugioh gx singles[/url] christian dating tip idea http://loveepicentre.com/ nudist nataturist nude dating

1:15 AM  
Anonymous Anonymous said...

symptoms of statin cholesterol medication [url=http://usadrugstoretoday.com/discounts.htm]pharmacy discounts[/url] vitamin d for low blood calcium http://usadrugstoretoday.com/products/cialis-soft-tabs.htm psopalen medical preparation http://usadrugstoretoday.com/products/motrin.htm
health care design las vegas [url=http://usadrugstoretoday.com/products/omnicef.htm]omnicef[/url] artifical kidney pan 6 [url=http://usadrugstoretoday.com/products/viagra.htm]international health insurance massachusetts[/url]

10:22 AM  
Anonymous Anonymous said...

antifungal tea tree manuka [url=http://usadrugstoretoday.com/products/accutane.htm]accutane[/url] cambridge health institute http://usadrugstoretoday.com/categories/cholesterin.htm free diet recipe http://usadrugstoretoday.com/categories/cholesterol.htm
vitamin supplements and breastfeeding [url=http://usadrugstoretoday.com/catalogue/g.htm]No prescription online pharmacy[/url] geriatric medicine md jobs denver [url=http://usadrugstoretoday.com/products/baclofen.htm]tristan heart[/url]

11:02 AM  
Anonymous Anonymous said...

no place like home home health agency tennessee [url=http://usadrugstoretoday.com/products/glucotrol-xl.htm]glucotrol xl[/url] mineral hunting in wyoming http://usadrugstoretoday.com/products/zoloft.htm marketing union medical center blairsville ga http://usadrugstoretoday.com/products/prednisone.htm
missouri board of medicine [url=http://usadrugstoretoday.com/products/ed-discount-pack-2.htm]Order ED discount pack 2[/url] pharmacy online flexeril [url=http://usadrugstoretoday.com/categories/disfunzione-erettile.htm]heart sound monitor[/url]

1:37 PM  
Anonymous Anonymous said...

fish oil for dosage anti depressant fish oil [url=http://usadrugstoretoday.com/products/aricept.htm]aricept[/url] exercise loss walking weight http://usadrugstoretoday.com/products/medrol.htm maxillary sinus infection http://usadrugstoretoday.com/products/ayurslim.htm
health and wellness prevention divided in age groups [url=http://usadrugstoretoday.com/products/lopid.htm]lopid[/url] medicare prescription plan passed [url=http://usadrugstoretoday.com/products/biaxin.htm]pain in the left breast[/url]

10:32 PM  
Anonymous Anonymous said...

long island realtor where to get health insurance [url=http://usadrugstoretoday.com/products/sinemet.htm]sinemet[/url] tooth dental toys for children http://usadrugstoretoday.com/categories/erectile-dysfunction.htm blood and inventory safety http://usadrugstoretoday.com/products/frozen--energy-and-libido-enhancer-.htm
forums for depression [url=http://usadrugstoretoday.com/products/epivir.htm]epivir[/url] market spice tea bulk tea [url=http://usadrugstoretoday.com/tos.htm]nightwish sleeping sun[/url]

10:45 PM  
Anonymous Anonymous said...

arizona health sciences [url=http://usadrugstoretoday.com/catalogue/h.htm]No prescription online pharmacy[/url] dick bergman shoppers food and pharmacy http://usadrugstoretoday.com/products/prometrium.htm tea cup poodles for sale http://usadrugstoretoday.com/products/aldactone.htm
canadian medical supply online [url=http://usadrugstoretoday.com/products/cefadroxil.htm]cefadroxil[/url] get paxil generic paroxetine for only 149 in the free [url=http://usadrugstoretoday.com/products/femara.htm]newhampshire drug rehabilitation[/url]

9:38 PM  
Anonymous Anonymous said...

http://alwayshealth.in/muscle/random-muscle-sensory-symptoms
[url=http://alwayshealth.in/heart-rate/about-american-heart-association]prescription drugs treatment[/url] canadian drugs biafine emulsion [url=http://alwayshealth.in/pravastatin/pravastatin-sodim]pravastatin sodim[/url]
drug testing in michigan http://alwayshealth.in/syndrome/down-syndrome-lifespan
[url=http://alwayshealth.in/heart-disease/a-heart-diet-to-lose-weight]pharmacys in aberdeen with minor ailments scheme[/url] how long do certain drugs stay in the body [url=http://alwayshealth.in/pain-relief/lower-back-pain-ice-relief]lower back pain ice relief[/url]
illegal drugs and how they affect you http://alwayshealth.in/natural-health/virginia-department-of-health-and-human-services
[url=http://alwayshealth.in/heart-rate/crimes-of-the-heart-arbutus-theaterical-company]davis pharmacy[/url] pharmacy in springfield ohio [url=http://alwayshealth.in]Always Health - Free Online Health Information and Articles[/url] pharmacy celecoxib [url=http://alwayshealth.in/olmesartan/olmesartan-nitrendipine-equivalent-doses]olmesartan nitrendipine equivalent doses[/url]

2:30 PM  
Anonymous Anonymous said...

maserati automobile inventory search http://automotoportal.in/skoda/skoda-octavia-photos motorcycle racing
[url=http://automotoportal.in/lamborghini/lamborghini-vs-gokart]the first automobile[/url] automobile backup lights [url=http://automotoportal.in/seat/pasco-county-seat-florida]pasco county seat florida[/url]
auto immune aarda gov http://automotoportal.in/panoz/panoz-gt
[url=http://automotoportal.in/volkswagen/volkswagen-dealers-seattle]indianapolis automobile races[/url] bill of sale document for automobile [url=http://automotoportal.in/motorcycles/manchester-pa-honda-motorcycles]manchester pa honda motorcycles[/url]
automobile chemistry pun http://automotoportal.in/pontiac/price-buick-pontiac-salisbury
[url=http://automotoportal.in/scooters/upright-electirc-scooters]new mercedes suv models[/url] california license for auto mechanics [url=http://automotoportal.in]New car pictures, prices and reviews[/url]

12:12 PM  
Anonymous Anonymous said...

international travel fares http://livetravel.in/flight/the-flight-of-a-bumble-bee new years travel packages
[url=http://livetravel.in/hotel/the-benjamin-hotel-restaurant-nearby]march warm travel places[/url] gis travel mug [url=http://livetravel.in/vacation-packages/aaa-vacation-disney-package-htm]aaa vacation disney package htm[/url]
christmas travel statistics http://livetravel.in/lufthansa/airbus-and-boeing
[url=http://livetravel.in/cruises/cruises-from-philadelphia]portage glacier facts reports travel guides[/url] tours holiday travel [url=http://livetravel.in/cruises/princess-cruises-home-page-htm]princess cruises home page htm[/url]
canadian student travel health insurance http://livetravel.in/car-rental/ft-lauderdale-florida-rental-car
[url=http://livetravel.in/motel/boots-motel]name your price travel[/url] dept of state travel warnings [url=http://livetravel.in/cruises/the-cat-cruises]the cat cruises[/url] cheap flights cheapest travel [url=http://livetravel.in/adventure/adventure-scotland]adventure scotland[/url]
airport stores with foldup travel carts [url=http://livetravel.in/disneyland/best-day-to-visit-disneyland]best day to visit disneyland[/url]
pacific islands with air travel http://livetravel.in/adventure/la-selva-adventure-resort
[url=http://livetravel.in/travel]air travel limits[/url] excel travel expense sheet [url=http://livetravel.in/travel/cheapest-travel-ireland]cheapest travel ireland[/url]
[url=http://livetravel.in/vacation-packages/vail-ski-vacation-package]vail ski vacation package[/url] lymphatic pump travel size [url=http://livetravel.in/tour/tour-liechtenstein]tour liechtenstein[/url] travel by train europe [url=http://livetravel.in/flight/navy-flight-deck-pictures]navy flight deck pictures[/url]
air travel to iquitos peru [url=http://livetravel.in/cruises/cruises-from-norfolk]cruises from norfolk[/url]

2:31 PM  
Anonymous Anonymous said...

tvr automobile http://latestcarnews.in/yamaha computer automobile gauge display
[url=http://latestcarnews.in/rally/mopar-15x7-rally-wheels]lynx auto install[/url] sonrise foriegn auto salvage [url=http://latestcarnews.in/toyota/toyota-udt]toyota udt[/url]
dodge tonneau covers http://latestcarnews.in/racing/free-car-racing
[url=http://latestcarnews.in/saab/saab-abbot-performance]automobile waxes[/url] automobile zing [url=http://latestcarnews.in/royce/rolls-royce-catalogs]rolls royce catalogs[/url]
full auto bb gun plans http://latestcarnews.in/plymouth/new-plymouth-accomodation
[url=http://latestcarnews.in/scooter/chineese-scooter]classic automobile classifieds[/url] lease volkswagen tourag atlanta [url=http://latestcarnews.in/royce/rolls-royce-raynesway-01332]rolls royce raynesway 01332[/url]

12:12 PM  
Anonymous Anonymous said...

discovery chanel http://topcitystyle.com/white-grey-red-blue-leather-shoes-color223.html nike basketball shoes team [url=http://topcitystyle.com/-dress-shirts-armani-category5.html]elegant fashion outlet wedding[/url] most comfortable shoes
http://topcitystyle.com/?action=products&product_id=944 designer glasses [url=http://topcitystyle.com/explosion-brand107.html]crepe soled shoes[/url]

9:06 PM  
Anonymous Anonymous said...

winter clothes small children http://topcitystyle.com/terra-cotta-women-color233.html marie antoinette fashion [url=http://topcitystyle.com/funky-page7.html]carolina shoes[/url] buy new balance shoes
http://topcitystyle.com/white-beige-dolce-amp-gabbana-color197.html crochet baby clothes [url=http://topcitystyle.com/prada-casual-shirts-brand10.html]zoppa shoes[/url]

8:42 PM  
Anonymous Anonymous said...

adult film producer directory http://planetofporn.in/erotic-video/erotic-personal-webpage
[url=http://planetofporn.in/adult-xxx/free-adult-dirty-sites]uk porn videos amateur wife[/url] sexy cock [url=http://planetofporn.in/ass-video/free-gapping-ass-creampie]free gapping ass creampie[/url]
rikku adult game http://planetofporn.in/erotic-gay/my-tube-erotic-shemales
[url=http://planetofporn.in/free-amateur/german-amateur-models-17-yo]hentai factory[/url] adult bogs [url=http://planetofporn.in/adult-video/bush-river-md-adult-bookstore]bush river md adult bookstore[/url]
online hentai rpg http://planetofporn.in/condom/huge-inflatable-dildo
[url=http://planetofporn.in/ass-video/emoticons-bare-ass]sexy shemale blowjob[/url] totally free adult dateing [url=http://planetofporn.in/amateur-porn/amateur-japanese-couple]amateur japanese couple[/url]
bleach hentai gallarys http://planetofporn.in/adult-online/adult-film-actress-hire
[url=http://planetofporn.in/adult-video/adult-size-trail-a-long]cream pies adult site[/url] sexy mind control stories [url=http://planetofporn.in/blow/grocery-store-blow-job]grocery store blow job[/url]

6:36 PM  
Anonymous Anonymous said...

journey to the center of the earth movie trivia [url=http://worldmovs.co.cc/full_version-iceage/6331database/]Iceage[/url] good luck chuck the movie [url=http://worldmovs.co.cc/full_version-lettres-d-iwo-jima/513database/]Lettres D'Iwo Jima[/url]
toronto movie listings [url=http://full-length-movies.com/dvd-quality-movie-10-questions-for-the-dalai-lama/9972database/]10 Questions for the Dalai Lama[/url] new tyler perry movie [url=http://worldmovs.co.cc/full_version-supersalidos--2cd-/12805database/]Supersalidos (2CD)[/url]
windows vista watch and burn a movie [url=http://worldmovs.co.cc/full_version-border-lost/8981database/]Border Lost[/url] cum movie gallery [url=http://full-length-movies.com/dvd-quality-movie-aceh---the-black-road/16298database/]Aceh - The Black Road[/url]
the wild bunch movie [url=http://worldmovs.co.cc/full_version-sydney-white/14854database/]Sydney White[/url] fucking teen free movie [url=http://full-length-movies.com/dvd-quality-movie-a-pup-named-scooby-doo--vol-3-/23692database/]A Pup Named Scooby Doo (Vol 3)[/url]

8:47 PM  
Anonymous Anonymous said...

beautifeel shoes http://www.thefashionhouse.us/?action=products&product_id=1984 clothes homemade [url=http://www.thefashionhouse.us/navy-blue-purple-women-color225.html]bellydancing clothes[/url] porcelain miniature fashionable parisiennes
http://www.thefashionhouse.us/dolce-amp-gabbana-sport-suit-for-men-grey-item2463.html backstage hairdesigner [url=http://www.thefashionhouse.us/xl-winter-jackets-size6.html]gas clothes dryers btus[/url]

11:44 PM  
Anonymous Anonymous said...

otc sleeping pills [url=http://usadrugstoretoday.com/products/stress-relief.htm]stress relief[/url] prednisone and cholesterol http://usadrugstoretoday.com/categories/arreter-de-fumer.htm
hermes herbal tea [url=http://usadrugstoretoday.com/products/maxalt.htm]maxalt[/url] depression hurst [url=http://usadrugstoretoday.com/products/strontium-bone-maker.htm ]milky white breast [/url] step daughtrt saw my penis
samters syndrome remedy [url=http://usadrugstoretoday.com/products/imodium.htm]imodium[/url] medical qualifications for pilots http://usadrugstoretoday.com/products/deltasone.htm
richmond dental clinic sharma british columbia [url=http://usadrugstoretoday.com/products/inderal.htm]inderal[/url] prostate massage coax [url=http://usadrugstoretoday.com/categories/antidepressivo---anti-ansia.htm ]normal blood glucose level mmol [/url] medical marijuana side effects

9:11 PM  
Anonymous Anonymous said...

where to buy croc shoes in mexico city http://www.thefashionhouse.us/dark-grey-women-apos-s-long-sleeve-tops-color16.html rockport shoes home page [url=http://www.thefashionhouse.us/gucci-page11.html]etnies skate shoes at zappos[/url] funky maternity clothes
http://www.thefashionhouse.us/shirts-page15.html mother of the groom fashions [url=http://www.thefashionhouse.us/off-white-polo-shirts-color3.html]basketball flight nike shoes[/url]

10:04 PM  
Anonymous Anonymous said...

travel feature writing http://xwl.in/tourism/theories-on-tourism zune travel pack for zune 30gb
[url=http://xwl.in/hotel/copacabana-palace-hotel-rio]travel scabble[/url] scrabble travel game [url=http://xwl.in/airport/airport-homes-florida]airport homes florida[/url]
sunway travel ireland http://xwl.in/cruise/best-kid-friendly-cruise-ships
[url=http://xwl.in/motel/motel-for-sale-in-wahington]flamingo world discount travel[/url] crusises travel packages [url=http://xwl.in/travel/travel-and-tourism-awards]travel and tourism awards[/url]
golden horse travel melbourne http://xwl.in/travel/travel-tourism-history air travel cuba [url=http://xwl.in/airlines/new-airlines-for-2007]new airlines for 2007[/url]

1:30 PM  
Anonymous Anonymous said...

plugged in movie reviws [url=http://moviestrawberry.com/films/film_duel_in_the_sun/]duel in the sun[/url] century movie novato http://moviestrawberry.com/hqmoviesbygenres/download-genre_mystery-movies/?page=15 horror movie tarantulas
jade marcela nyomi marcela lesbian movie [url=http://moviestrawberry.com/films/film_karma_confessions_and_holi/]karma confessions and holi[/url] simpons movie dvd http://moviestrawberry.com/films/film_30_days_of_night/ donkey punch movie
women of desire movie [url=http://moviestrawberry.com/films/film_beer_wars/]beer wars[/url] movie cessna plane crossing the atlantic
movie dvd clubs [url=http://moviestrawberry.com/films/film_the_gift/]the gift[/url] anna sten movie http://moviestrawberry.com/films/film_plaguers/ the last outlaw movie
stealth the movie [url=http://moviestrawberry.com/films/film_avalon/]avalon[/url] headcheese movie http://moviestrawberry.com/films/film_first_wave/ movie theaters rockford illinois

4:44 PM  
Anonymous Anonymous said...

ang pagdadalaga ni maximo oliveros movie [url=http://moviestrawberry.com/films/film_fear_house/]fear house[/url] yamagola telugu movie online for free http://moviestrawberry.com/films/film_beverly_hills_cop/ movie roots kunte kinte
vampire movie list [url=http://moviestrawberry.com/films/film_robin_hood_70/]robin hood 70[/url] made in america movie http://moviestrawberry.com/films/film_kindergarten_cop/ movie future clone
hackers movie [url=http://moviestrawberry.com/films/film_charlie_bubbles/]charlie bubbles[/url] britney spears mtv movie awards
long movie thumbs [url=http://moviestrawberry.com/films/film_butch_cassidy_and_the_sundance_kid/]butch cassidy and the sundance kid[/url] superbad movie desktop backgrounf http://moviestrawberry.com/films/film_bones/ disclosure the movie
adult movie stars [url=http://moviestrawberry.com/films/film_pluto_s_blue_note/]pluto s blue note[/url] movie rewiew http://moviestrawberry.com/films/film_david_spade_take_the_hit/ digimon tamers movie

7:47 PM  
Anonymous Anonymous said...

movie download sites [url=http://moviestrawberry.com/films/film_the_new_adventures_of_pippi_longstocking/]the new adventures of pippi longstocking[/url] thumbnail movie http://moviestrawberry.com/films/film_blank_check/ spiderman 2 the movie
cast of jackass the movie [url=http://moviestrawberry.com/films/film_chelsea_lately/]chelsea lately[/url] four seasons movie cinema http://moviestrawberry.com/films/film_the_boondock_saints/ the movie granny
murderball the movie [url=http://moviestrawberry.com/films/film_the_bill/]the bill[/url] pointe orlando regal movie theater
movie hostile [url=http://moviestrawberry.com/films/film_the_good_night/]the good night[/url] when savannah smiles movie http://moviestrawberry.com/films/film_g_p_s_/ peacemaker movie
wiggles movie direct download [url=http://moviestrawberry.com/films/film_full_metal_jacket/]full metal jacket[/url] harry potter movie download full http://moviestrawberry.com/films/film_major_movie_star/ synposis on the movie the core

9:22 PM  
Anonymous Anonymous said...

cheap nike air max 90 rkfzltlb cheap nike air max eglocbpj nike air max 1 qwealbiv nike air max 90 ytjsbcld nike air max 95 ohuscfer nike air max toybsdde nike free run pjjajbqs nike store uk nsuurdxb nike uk lknlvtkh

9:39 AM  
Anonymous Anonymous said...

What's Happening i am new to this, I stumbled upon this I've
discovered It absolutely useful and it has helped me out loads.
I'm hoping to give a contribution & aid other customers like its aided me. Good job.

Also visit my site - http://www.teenpornsexpussy.com

7:05 PM  

Post a Comment

<< Home