$pattern = qr/A/; if ('a' =~ m/$pattern/i) { print("Match (case-insensitive)\n"); } else { print("No match (case-sensitive)\n"); }