use strict; use warnings; open(FH,"data"); foreach ( ){ if ( $_ =~ m/^https.*[^\/]\n$/ ) { print $_; } }