use strict; use warnings; my @strings = ( '12', '34', '56', '78', '910', ); foreach my $line (@strings) { foreach my $zip ( $line =~ m|href="(http.+?\.zip)"|g ) { print $zip, "\n"; } }