in reply to how to nullify case sensitivity

There is more than one way to do it:
use Modern::Perl; while (my $first = <DATA>) { my $second = <DATA>; chomp $first; chomp $second; say "Is >$first< equal to >$second<? ", ($first =~ m/^$\Qsecond\E$ +/i)?'Yes':'No'; } __DATA__ test TEST testing testing TESTED TESTED TeStS tEsTs a Test another Test
Output:
Is >test< equal to >TEST<? Yes Is >testing< equal to >testing<? Yes Is >TESTED< equal to >TESTED<? Yes Is >TeStS< equal to >tEsTs<? Yes Is >a Test< equal to >another Test<? No
Update: added the quotemeta tags \Q \E.</inq>

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: how to nullify case sensitivity
by Anonymous Monk on Nov 24, 2010 at 10:04 UTC
      Indeed! Thank you for reminding me.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James