use strict; my @fields; my $RS = ' '; my $rv = &do_this; print $rv; sub do_this { while(){ next unless $. == 2; @fields = ( split /$RS/, $_ ), last if $. == 2; @fields = ( split /$RS/, $_ ), last if $. == 2; } return $fields[2] =~ /\d+/; } __DATA__ This is line one. I found 12 on line two. And This was found on line three.