for (@image_extensions) { if ($url =~ /\.${_}$/) { #### for my $ext (@image_extensions) { if ($url =~ /\.$ext$) {