Andrew Gaffney wrote:

> John W. Krahn wrote:
> > Whenever you want unique values think "hash".
>
> Well, it would have been weird to have a hash with keys named 'NET USE F:
> \\\\SKYLINE\\SKYLINEF\r\n'.

No.  It is not at all wierd to use hash for any of the puroses for which it is 
well-suited.
Among of those purposes are ensuring unique .ness and testing existence.  1-valued 
hashes are
extremely efficient engines fr both

my $paths_seen = {};
foreach $drive (keys drives) {
   my $map_command = $drive{$_};
   next if $paths_seen->{$map_command);
   assign_drive($map_command);
   $paths_seen->{$map_command) = 1;
}

The above assumes that you are willing to make brute-force assumptions about which 
mapping to a
particular share is the appropriate one.  If there are factors you wish to weigh in 
chosing which
mapping to keep, you would want to call some resolving function when an element is 
found rather
than simply next-ing.

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to