$str= quotemeta 'C:\Windows'; if ( $path =~ /^$str/i ) { ...