sub my_search { ($file) = @_; open(FILE, $file) || die "Unable to open $file: $!\n"; while () { if (/^Number 1/) { $_ =~ s/\s+/ /g; my @Number = split(" ",$_); # line above only brings me to the headers of the "text table" } }