in reply to Getting info with a small flatfile db.

you don't need the line number to access the info in your db, but this should work for you.

use strict; use vars qw/ $lines $blah1 $blah2 $blah3 /; sub count_lines { $lines = 0; open(FILE, "filename"); while(<FILE>) { $lines += ($_ =~ tr/\n//); } print "$lines lines in filename\n"; close (FILE); } sub breakup_lines { open(FILE, "filename"); while(<FILE>) { ($blah1,$blah2,$blah3) = split(/\|/, $_); ## do something with the blahs } close (FILE); }

also you may want to check out these nodes: Another flatfile thingy & Poor Person's Database and how could we forget the Super Search?

Update: I see you don't know how many columns you are going to have. so instead use

sub breakup_lines { open(FILE, "filename"); while(<FILE>) { push @blah, (split /\|/); ## do something with the @blah } close (FILE); }
.

then you can do whatever with @blah (oh and add @blah to the vars statement at the top.)

-p