42 users online (0 members and 42 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 1
  2. CGI / Perl    Forum: HTML Forum
    Replies: 1
  3. Replies: 1
  4. Replies: 0
  1. #1
    currentOp's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2007
    Posts
    2

    Need help with perl

    Code:
    foreach my $key1 (sort keys %{$Vrs{Date}}) 
    {
        foreach my $key2 (keys %{$Vrs{Date}{$key1}}) 
        {
            print "                    <Option VALUE='$key1--$key2'>$key1-$key2</OPTION>\n";
        }
    }
    I just want to understand the code above.. if anyone can explain it that will be great.
    And plus how can I sort it based on the first key and then second key.. what changes do I need to make from that code?

    Thanks
    Last edited by DeadMeatGF; 02-28-2007 at 09:06 AM. Reason: Added Code tags

  2. #2
    currentOp's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2007
    Posts
    2

    Re: Need help with perl

    I do not see $key in the code except in this part.
    This is the details which might or might not give more information.
    TD>
    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
    <TD>By Date Discussed: </TD>
    </TR>
    <TR>
    <TD> &nbsp;&nbsp;&nbsp;
    <SELECT NAME=MeetingDate>'."\n";
    foreach my $key1 (sort keys %{$Vrs{Date}}) {
    foreach my $key2 (keys %{$Vrs{Date}{$key1}}) {
    print " <Option VALUE='$key1-$key2'>$key1--$key2</OPTION>\n";
    }
    }
    print' </SELECT>
    </TD>
    </TR>
    </TABLE>
    </TD>
    from my investigation, the $keys 1 is actually some sort of string, and $keys 2 is a date format.
    As far as I know , this code create a combo box in the web interface. And populating all the information based on this keys..
    I do not quite understand how it works. As far as I know we usually when we use some sort of Sorting, we use "@" which is an array.
    Any help would be appreciated. Thank you in advance.



Tags for this Thread