Harry Putnam <[email protected]> writes:
> [...]
>
> ARRAY(0x91af588) convol5.pnm
> exits only in rh1
> --- --- ---
> ARRAY(0x91aeb38) .arch-inventory
> exits only in rh1
>
> [...]
>
> How can I get the actual name represented by `ARRAY(0x91af588)' etc?
> Is Data::Dumper (or some other module) the only way, or can I get at
> it with no extra modules from the inverted hash?
Finally my google strings hit paydirt and I discovered the use of
@{ $h{$name} }
To get at the content of what is only a reference to a hash. `@' as
used above is said to `dereference' it.
But I'm still getting (some) confusing output... too many names on the
left side of the printf.
for my $name ( keys %inv_h1 ){
if ( ! exists $inv_h2{$name} ){
printf "%-56s %s %s\n",@{$inv_h1{$name}}, $name,"
exits only in h1\n--- --- ---";
}
}
There are a few cases where $name matches more than 1 $h1{$name}
And I think, in those cases the above printf is showing those. instead
of: $h1{$name} $name
It appears to be showing
$h1{$name} $h1{$name} [etc]
where those are different in the path only.
Here is an example (on several lines since they are quite long, but
is on one line in the actual output [with annotations]):
(1 $h1{$name}
./dir1/texi/etc/gnus-group-unsubscribe-up.xpm
(2 $hi{$name}
./dir1/etc/images/gnus/gnus-group-unsubscribe-up.xpm
(and finally $name)
gnus-group-unsubscribe-up.xpm
That is, the line ends up displaying the entire path name of 2 or more
files plus $name. However many that had the same $name at the end.
So I think I've just found how to access those items I was asking
about, that inverting preserves ... hehe.
It looks like this is a case where the `reverse' operator would
be better to use. Just get rid of those duplicates momentarily to
do that one job of finding what is in h1 and not h2
Or can I still get the result I want from the inverted hash?
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/