At 02:04 PM 10/18/2006, Johnson, Reginald (GTI) wrote:
I am trying to understand this sort and uniq code that a came across in
the archive. This works, but I thought the %uniq would have the sort
and uniqed values. What is needed if I didn't want to print the values
out immediatedly but put them in an array or hash?
#!/usr/bin/perl
use strict;
use warnings;
my @holdArr =qw(apple pear lemon bananna apple pear);
my %uniq;
map{$uniq{$_}=1 and print "$_\n" unless $uniq{$_}
[EMAIL PROTECTED];
--------------------------------------------------------
How about:
[EMAIL PROTECTED];
for array:
my @uniqArr = keys%uniq;
print join "\t", @uniqArr, "\n";
If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain
or redistribute it. Click here for important additional terms relating to
this e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------