in reply to Comparing file contents to array values

grep

-derby

update: Okay how about

@results = grep( /^$key/, @raw_data );
where key is the number your looking for. Sure you could do more fancy things like munge the array into a hash or DBFile but grep should suffice. All the matching records will be in results, then just roll through those to output the data you want:

foreach( @results ) { $record = $_; # strip the beginning key $record =~ s/^\d+//; print $record; }

Replies are listed 'Best First'.
Re: Re: simple for some
by nasa (Beadle) on Nov 23, 2002 at 03:35 UTC
    Brilliant Derby It dose everything I asked for. There is the called string right there in front of me. Frustrating I can see the elements but just can’t get hold of them. I didn’t really need to be rid of the first element so I tried
    foreach( @results ) { $record = $_; print $record; } @test = $record; print @test[0];
    Then it prints the entire string again. Then
    foreach( @results ) { $record = $_; print $record; } @test = $record print @test[1];
    Then it prints nothing in the second print. Then
    foreach( @results ) { $record = $_; print $record; } @test = $record $scalar = $array[0]; print $scaler;
    but nothing. I just need to get hold of the elements individually so I can do something with the little critters. May god bless you guys.