>>>>> "HP" == Harry Putnam <rea...@newsguy.com> writes:

  >> ARRAY(0x91af588)                   convol5.pnm 

  HP> Finally my google strings hit paydirt and I discovered the use of

  HP>      @{ $h{$name} }

  HP> To get at the content of what is only a reference to a hash.  `@' as
  HP> used above is said to `dereference' it.

it is a reference to an ARRAY. it says so in the ref you printed
out. please be more accurate in what you write. programming requires
high accuracy and you are continously sloppy in your posts. it is part
of the problem you are always fighting it seem. terminalogy MATTERS. use
the correct terms and it will HELP YOU.

read perldoc perlreftut, perllol, perldsc and perlref to learn more
about references. since you are getting into them (hell, the dispatch
table uses CODE references but you didn't seem to connect the concept to
ARRAY refs), you might as well learn them too. i am getting to the point
where i think you are trying to cram too much new code into this basic
program you are doing.

  HP> But I'm still getting (some) confusing output... too many names on the
  HP> left side of the printf.

  HP>   for my $name ( keys %inv_h1 ){
  HP>     if ( !  exists $inv_h2{$name} ){
  HP>       printf "%-56s %s %s\n",@{$inv_h1{$name}}, $name,"

do you understand how printf works? each % designates a field with an
value to be passed in the argument list. you are expecting  3
values. what if the inverted hash entry only has ONE value? this is what
i mean about being exact. 

  HP> Or can I still get the result I want from the inverted hash?

don't use sprintf like that with a list of an unknown size as it won't
work. better to format each array entry in a loop (map or foreach) and
then concatenate them and then sprintf the result. 

and no, i won't show you an example. this is stuff you should learn
slowly on your own. you are going way to fast and this is hurting
you. get to know perl basic data well first. then data structures, then
more refs, then dispatch tables. build on core ideas first. you are
diving into the very deep end without a life preserver. we are not life
guards. this is a perl beginner's list and even though we cover all
those topics, never should they be covered this way.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
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