in reply to Function speeds: lc() vs. eq vs. =~
Firstly, none of your cases are the same. You could use:
and you'd have to use: if( $type eq 'cr' || $type eq 'CR' || $type eq 'Cr' || $type eq 'cR' )if( $type =~ /^CR\Z/i ) # or if( $type =~ /^CR$/i ) # if you want to allow for ignoring trailing newlines
I'd argue that the speed difference is of extremely little importance in this case.
Use whichever makes the most readable code. So that eliminates the second one in my book. I like the first one.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Function speeds: lc() vs. eq vs. =~
by Clownburner (Monk) on Apr 17, 2001 at 18:56 UTC |