without sorting

my %hash = map { $_, 1 } @array;
@array = keys %hash;

with sorting

my %hash = map { $_, 1 } @array;
@array = keys %hash;
@array = sort(@array); # sorting

with sorting (shorter)

my %hash = map { $_, 1 } @array;
@array = sort(keys %hash);

Related Posts

Tags: ,



Leave a Comment

You must be logged in to post a comment.

Copyright © 2008 iBiz Network Co., Ltd. Powered by wordpress, Theme by ericulous