open(IN,$my_file) || die "Can't open: $!"; while (my $line = ) { next unless $line =~ /0\s*$/; $line =~ /^(\d+.?\d*)//; if ($1 > .5) { # etc, etc } }