In would like to make the following routine case insensitive, so .doc, .DOC, .Doc, .Doc, .dOC will all pass. (and so on for .txt) Who can help me out?
if ($filename !~ /$attach_ext/) {
$attach_ext =~ s/\\//g;
$attach_ext =~ s/\$//g;
@ext = split (/\Q|\E/o,$attach_ext);
$attach_ext = join(" or ",@ext);
&site_html_request_error (" Only files with the following extension(s) are allowed: $attach_ext");
return;
}
Code:
my $attach_ext = '\.doc$|\.txt$'; if ($filename !~ /$attach_ext/) {
$attach_ext =~ s/\\//g;
$attach_ext =~ s/\$//g;
@ext = split (/\Q|\E/o,$attach_ext);
$attach_ext = join(" or ",@ext);
&site_html_request_error (" Only files with the following extension(s) are allowed: $attach_ext");
return;
}