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