LPM: 2d array ? for perl

Rich Bowen rbowen at rcbowen.com
Thu Dec 28 13:25:17 CST 2000


Ronald Edward Petty wrote:
> 
> how do u print a 2d array in perl.  Somehow i can only print the first
> word of the first entry doing this

I'm unable to figure out what you are trying to do here, so I suspect
that you are making it way harder than it needs to be.

This block:

while(@auth)
{
        print "@datafile[0]";
        splice(@auth, 0, 1);
        splice(@datafile, 0, 1);
}

does the same thing repeatedly for each element in @auth. That is
clearly not what you want to do. Basically, this block says, for each
element in @auth, print the first word of the first element of
@datafile. Sort of. Because @datafile[0] is a slice, not an element.

If I'm following you at all, you have a data file with |-delimited
records, and you're trying to do something with each of those records.
But I'm not sure what that something is.

-- 
Rich Bowen --  Director of Web Application Development
http://www.cre8tivegroup.com/  --  rich at cre8tivegroup.com
Have trouble remembering things?   http://www.idforgetmyhead.com/



More information about the Lexington-pm mailing list