thanks all! This works, and I am reading Perl cookbook.


-----Original Message-----
From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 10, 2001 10:44 AM
To: Jennifer Pan
Cc: [EMAIL PROTECTED]
Subject: Re: grep repetitive elements?


On Aug 10, Jeff 'japhy/Marillion' Pinyan said:

>  my %freq;
>  $freq{$_}++ for @list2;  # create a hash of key -> frequency
>
>  for (@list1) {
>    print $freq{$_} if $freq{$_} > 1;
>  }

Rather,

  print $_ if $freq{$_} > 1;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]
http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/
http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002
**


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to