in reply to Re: perl grep with regex
in thread perl grep with regex

Thank you for your response. Does it make any difference when i read arr2 from a file? (in my actual code i get this array by reading a file). i tried as you suggested and got below output.

Entered in else loop: /^mcs$/ found in (scr mcs tsz unh )

Replies are listed 'Best First'.
Re^3: perl grep with regex
by choroba (Cardinal) on Jun 30, 2014 at 13:37 UTC
    There's probably some whitespace at the end of the lines in the file. Remove it:
    s/\s+$// for @arr2;
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      actually the space was in the beginning of line. i removed it and now it is working correctly.