The first is clearer and less error prone (woe unto you if $str2 ever contains metacharacters as is), but presuming a recent perl both should be equally speedy.
Update: Wow, I must have heard wrong about the re speedups or something; I thought that they supposedly had gotten optimized so fixed strings were on the same order as a vanilla comparison but as the benchmark below shows that's not the case. So yeah, definitely option one.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Comparing strings case insensitive
by Fletch
in thread Comparing strings case insensitive
by zemane
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |