if ($url !~ m{^.*(jpe?g|gif|xbm|png|bmp)$}) { say "$url is not an image"; }