On Jan 21, 2004, at 6:46 PM, Luinrandir Hernsen wrote:


I thanks you very much for reply and all 3 ways do work.
unfortunately I did not state the situation completely.

$Building is to = the variable $EW0NS0 thru $EW10NS10
This is so I can set certain variables like
my $EW5NS5="TEST.gif";
to show a certain pictures, while other "squares" of the table remain empty.

Ah! I think I see a bit more where you are going, sounds like what you really want is an array of arrays so as not to need to worry about the problem of trying to create 'variables'.

As it now works $Building does = EW0NS0 etc, but I need $Building to equal
the string/value that $EW0NS0
represents early in the program. (a rread/write file will soon be built in
here.)

Right what you want to do is the majik variable trick. This is highly not recommended.

Do I express it better this time?
I apollogize for my lack or explination and Thank you for your efforts and
furture help.
[..]

My mistake for misreading the first time,
allow me to illustrate the idea.

        #!/usr/bin/perl
        use strict;
        use warnings;
        
        my ($Building, $row, $col);
        
        my $max=4;
        
        my @array = ();
        foreach $row (0..$max){
                foreach $col (0..$max){
                        $array[$row][$col] = "bob at ${row} said $col";
                }
        }
        
        $array[3][3] = "The Majik word is 3 by 3";
        
        print qq|Content-type: text/html\n\n|;
        
        my $EW5NS5="TEST.gif"; ##this is the string I need to build.
        
        print qq|<TABLE>\n|;
        foreach my $row (0..$max)
                {
                print qq|<TR>\n|;
                foreach my $col (0..$max)
                          {
                                $Building = $array[$row][$col];
                                print qq|<TD bgcolor=black>$Building</TD><TD></TD>\n|;
                          }
                print qq|</TR>\n|;
                }
        print qq|</TABLE>\n|;
        print qq|x $EW5NS5 x <br>\n|;
        print qq|x $Building x\n|;
        print "the Majik Word is: $array[3][3]\n";

HTH...

ciao
drieux




-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to