Shawn H Corey <shawnhco...@gmail.com> writes:

First, let me thank you for explaining every one of my questions
simply and fully.  Really nice to know there are people who seem to
understand so much of this.

[...]

>   my %inv_hash = invert( \%hash );
>   print '%inv_hash: ', Dumper \%inv_hash;
>
> This will output:
>
> %inv_hash: $VAR1 = {
>   'f2' => [
>     './b/l/c/f2'
>   ],
>   'fb' => [
>     './b/fb',
>     './b/g/h/r/fb'
>   ],
>   'fc' => [
>     './b/g/f/r/fc'
>   ],
>   'fd' => [
>     './b/c/fd'
>   ]
> };
>
> Note that both values for fb are preserved.

I hadn't caught that.  But that is really nifty.

If its not to much to ask, how would one get at both of those?

I was just sure the keys that were identical had been swallowed.  And
in fact in the actual case your original post pertained too, (not the
example we both used, but what I was trying to apply it to). It would
not have mattered much if they had actually disappeared.

What I was looking for there was to see which `$_'(end of path filenames) in
File::Find terms. in a hash of one directory were NOT in a similar but
far from identical other directory.  So in that case it would ease the
task by eliminating all duplicate endnames... that might not be the
same full path name.  And so the result would be only those files that
absolutely were not present.


Sorting out which of the duplicates mattered would come later and
could still be done with the uninverted parent hash.

But I see now it could have been done as well with inverted one... all
the while assuming all duplicates could be accessed somehow.

In fact I can see several uses now that I know that part.  You
probably showed it back then but I missed it.


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


Reply via email to