in reply to Problem with (recursively?) searching flat file database

There's a discrepancy between your narrative and your code fragments. Do you have form input in $line3 or $line[3]? They're not the same thing.
@results = grep( /^$line[3]/, @raw_data);
will match everything if $line[3] is not defined.

And even if $line[3] is defined, it's not going to do what you want. Let's say it holds "1". The regex will then match strings that start with "1", "12", "123", etc.

I suspect that you really want to do something like

@results = grep( (split(@_))[0] eq $line[3], @raw_data);