-- Back to square one?

# I define 3 variables  ...

  $TS   = time();
  $LN   = "Washington";                         # test value
  $CN   = "Costa Rica";                         #  "     "

# ... in order to build a HoH ...

  $newH{'TS'}           => $TS;         # TS is the outer key.   <<== line 33

# ... using this code ...

  %newH =  (
           TS   => {                                    # Note outer hash key, TS
                   'LN' => $LN,         # Last Name
                   'CN' => $CN,         # Country
                   },
           );

# ... to be printed looking like this ...

##  %clientdbm =
##      Mon Apr  5 16:23:33 2002  Last Name = Sickafus
##                                        Country   = USA
##
##      Tue Jan 21 15:39:02 2003  Last Name = Washington
##                                Country   = France
#

perl -w (this script) chokes on the build part and spits out ...

        Useless use of hash elem in void context at clientdata.cgi line 33.
        Useless use of a variable in void context at clientdata.cgi line 33.

#?  So, here I go again. How can I use the value of the outer key, TS,
#?  as its name for building the hash each time the script is run
#?  and then occassionally print it by sorting on the value of TS?
#?  Is that not what I need to do for the desired output?

Perplexed/ Ed

-------------------------------------------
This print-out snippet is now compiling, but not tested -- haven't gotten
that far! :(

my %tmp;
my $tmp = $dbm{$keyouter};
my $LT;

   foreach $keyouter(sort keys %dbm) {

        foreach $keyinner(keys %{$tmp}) {

                if ($tmp{$keyinner} eq "LN")
                        {
                        $LT = localtime($tmp);
                        print "$LT\tLast Name = $tmp{$keyinner}\n";
                        }
                else
                        {
                        print "\t\t\t\t\tCountry   = $tmp{$keyinner}\n";
                        }
                }
        };
------------------------------------------------------------


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to