while ( ){ $str = $_; #### I added this chomp; tr/\"//d; if (/^#/){ ### added this push (@zips,$_); next; } if (I want this location){ . . . } else{ push (@zips,$str); } } # while foreach (@zips){ print ; }