references

From: toylet (toylet_at_mail.hongkong.com)
Date: 02/19/04


Date: Thu, 19 Feb 2004 16:58:39 +0800

I am studying the examples in the book "Perl 5 by Examples". Here's a
short program from that book:

   my $dbf2 = { 3 => { 4=>5, 5=>6 } };
   my($key1,$value1,$key2,$value2);
   while (($key1,$value1) = each(%{$dbf2})) {
     print("level 1: $key1 => $value1\n");
     while(($key2,$value2) = each(%{$value1})) {
       print("level 2: $key2 => $value2\n");
     }
   }

The program would prints:

Level 1: 3 => HASH(123456)
Level 2: 4 => 5
Level 2: 5 => 6

Now, what if I create this (which passed the compilation):

   my $dbf3 = { { 4=>5, 5=>6} }

How could I make the same program work?

-- 
   .~.    Might, Courage, Vision. In Linux We Trust.
  / v \   http://www.linux-sxs.org
/( _ )\  Linux 2.4.22-xfs
   ^ ^    4:54pm up 2 days 18:48 load average: 1.00 1.00 1.00


Relevant Pages

  • Re: trapping file i/o error
    ... > In perl, opendoes not return a file handle but it does return ... > a true/false value you can test. ... In Linux We Trust. ...
    (comp.lang.perl)
  • UTF-8-codierte Umlaute via print und warn ausgeben
    ... Unter Windows/Cygwin im Cygwin-Terminal mit Cygwins Perl: ... Im UTF-8-Xterm funktioniert die Umlautausgabe mit print und warn, ... der zweite foo.pl-Aufruf unter Linux (und im ... Cygwin Perl (im xterm und im "gewoehnlichen" Cygwin-Terminal) und auch ...
    (de.comp.lang.perl.misc)
  • Re: Demand of PF CLI
    ... >> using the PF APIs directly, or providing such access in perl, python, ... >> style approach was taken to embrace other firewall solutions. ... > you mean this module could work for Linux iptables too. ... There is Linux's iptables, ipf on NetBSD and Solaris, ...
    (comp.unix.bsd.openbsd.misc)
  • Re: Should fresh graduates be good at platform specific libraries?
    ... curious enough about linux to setup a linux box. ... unix-like shell environment and have not discovered perl. ... kind of stuff that says you will not be passionate about this career. ... real regular expressions in an Automata Theory course. ...
    (comp.programming)
  • Re: Need help installing WWW-Search-Ebay-2.193 Module...
    ... One of the O'Reilly Books has a script that calls this ... >>languages (which are far easier to program in under Linux than under ... > perl Makefile.PL ... >>ActivePerl for Linux under Cygwin ...
    (comp.lang.perl.misc)