use strict; use warnings; my_search('data.txt'); sub my_search { my $file = shift; open my $in_fh, '<', $file or die "Unable to open $file: $!\n"; while (<$in_fh>) { next if (/^Number1/); my @Numbers = split; print "@Numbers\n"; } close $in_fh; }