while (<>) { chomp; next if (/(H|IF)-000$/ or !/^PH/); print "$_\n"; } #### next if (/[HI]-000$/ or !/^PH/);