How to remove duplicates from a hash

2010-09-29 Thread Richard Green
What would be the quickest , easiest way to remove duplicates from a hash?
Any suggestions are muchly appreciated. Thanks
-Rich




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: How to remove duplicates from a hash

2010-09-29 Thread John W. Krahn

Richard Green wrote:

What would be the quickest , easiest way to remove duplicates from a hash?
Any suggestions are muchly appreciated. Thanks


I assume you mean duplicate values because all keys are unique.

$ perl -le'
use Data::Dumper; 


my %hash = qw/ a z b z c x d x e y f g h i /;
print Dumper \%hash;
%hash = reverse %{{ reverse %hash }};
print Dumper \%hash;
'
$VAR1 = {
  'e' = 'y',
  'c' = 'x',
  'h' = 'i',
  'a' = 'z',
  'b' = 'z',
  'd' = 'x',
  'f' = 'g'
};

$VAR1 = {
  'e' = 'y',
  'c' = 'x',
  'a' = 'z',
  'h' = 'i',
  'f' = 'g'
};



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: How to remove duplicates from a hash

2010-09-29 Thread Paul Johnson
On Tue, Sep 28, 2010 at 08:10:30AM -0700, Richard Green wrote:

 What would be the quickest , easiest way to remove duplicates from a hash?
 Any suggestions are muchly appreciated. Thanks

I presume you mean duplicate values, because hashes don't have duplicate keys.
Do you care which values get removed?  If not, then:

   %x = reverse %x; %x = reverse %x;

will do the trick.

That's the quickest and easiest method according to some criteria, anyway.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: How to remove duplicates from a hash

2010-09-29 Thread Shlomi Fish
Hi Rich,

On Tuesday 28 September 2010 17:10:30 Richard Green wrote:
 What would be the quickest , easiest way to remove duplicates from a hash?
 Any suggestions are muchly appreciated. Thanks
 -Rich

What do you mean by duplicates from a hash? A hash cannot have duplicate 
keys. If you do:

$hash{'name'} = Foo;

And then:

$hash{'name'} = Bar;

Then you won't have two 'name' keys - only one whose value will be Bar.

See:

http://perl-begin.org/topics/hashes/

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
What Makes Software Apps High Quality -  http://shlom.in/sw-quality

rindolf She's a hot chick. But she smokes.
go|dfish She can smoke as long as she's smokin'.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: How to remove duplicates from a hash

2010-09-29 Thread Richard Green
These are great suggestions thanks everyone!
-Rich



On Sep 29, 2010, at 2:39 AM, Paul Johnson p...@pjcj.net wrote:

 On Tue, Sep 28, 2010 at 08:10:30AM -0700, Richard Green wrote:
 
 What would be the quickest , easiest way to remove duplicates from a hash?
 Any suggestions are muchly appreciated. Thanks
 
 I presume you mean duplicate values, because hashes don't have duplicate keys.
 Do you care which values get removed?  If not, then:
 
   %x = reverse %x; %x = reverse %x;
 
 will do the trick.
 
 That's the quickest and easiest method according to some criteria, anyway.
 
 -- 
 Paul Johnson - p...@pjcj.net
 http://www.pjcj.net
 
 -- 
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/
 
 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




How to get the Pause ID

2010-09-29 Thread Parag Kalra
Hi All,

I have been trying to get Pause ID but seems like either the request is
getting rejected or something is wrong in the way I am raising the request.

I have applied twice in past.

EG: http://www.nntp.perl.org/group/perl.modules/2010/09/msg72805.html

Could someone please share some pointers on it.

Cheers,
Parag


Re: How to get the Pause ID

2010-09-29 Thread Jeff Pang
2010/9/30 Parag Kalra paragka...@gmail.com:
 Hi All,

 I have been trying to get Pause ID but seems like either the request is
 getting rejected or something is wrong in the way I am raising the request.


Please send the message to the CPAN related mailing lists.
http://lists.perl.org/all.html

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/