in reply to how do I open each line of a text file into seperate arrays?

You could use an array of arrays:

# open FILE while(<FILE>) { # The []'s make an anonymous array, so each element # of @lines is actually an array-ref. push @lines, [split /\|/, $_]; } print "Yep.\n" if $lines[0][0] eq 'foo'; # it will

HTH.

Upd: oops, fixed my array indexes. :-)

Upd2: damn, what was I thinking? Changed @lines = [...] to proper push.

Upd3: ARGH!!! Thanks for the eq catch, buckaduck. That's what I get when I try to rush a post... :-(

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.

Replies are listed 'Best First'.
Re: (bbfu) (AoA?) Re: how do I open each line of a text file into seperate arrays?
by buckaduck (Chaplain) on May 01, 2001 at 01:17 UTC
    print "Yep.\n" if $lines[0][0] == 'foo';
    I think you mean:
    print "Yep.\n" if $lines[0][0] eq 'foo';

    Just when you thought the updates were over...

    buckaduck

Re:{3} how do I open each line of a text file into seperate arrays?
by jeroenes (Priest) on May 01, 2001 at 18:18 UTC
    Yet Another Use for SuperSplit!

    use SuperSplit; $AoA = supersplit_open( /\|/, $filename );
    ...and it's all there in $AoA.

    Jeroen
    "We are not alone"(FZ)