while ( ) { print if /\Ahttps.*[^\/]\n\z/; } __DATA__ http://perlmonks.org/?node_id=825405 HTTPS://gmail.com https://gmail.com/ httpsux https://perlmonks.org/? https://mail.google.com/mail/#inbox