in reply to qr and substitution
$pattern = "foobar"; if ( /$pattern/i ) { } # equivalent to the more flexible form of $pattern = "(?i)foobar"; if ( /$pattern/ ) { } [download]