in reply to Re: accessing array items
in thread accessing array items

Yes, I guess this is a question on how to manipulate arrays in Perl. The data is in a text file. The code looks like this:
foreach (<>) { $line=$_; if ($line =~ m(^\s{2}[-0])) #gets us to required lines in dataset { chomp $line; @items_in_line = split ' ', $line; } print $items_in_line[o]; }
Prob is, I cant seem to get at the individual numbers on each line.
thanks again!

Replies are listed 'Best First'.
Re^3: accessing array items
by apl (Monsignor) on Jul 29, 2008 at 11:28 UTC
    $items_in_line[3] would give you the fourth value on the line. (Indices start at 0, though you can change that if you need to.)

    Be careful to make certain there really is a fourth value before you try to manipulate it. ($#items_in_line is the number of elements in the array.)