while (){ next if /^#/; # extract $zip, leave line unmodified in $_ ( my $zip = ( split /,/ )[ 2 ] ) =~ tr/"//d; if ( I want this zip code){ . . . } else{ push (@zips,$_); close(ZIPS); } }