while ( <$fh> ) { my ($yr, $mon, $day) = parse_date($_); next if ! defined $yr; # ... }