I am new to perl and writing my first few programs and using its pattern matching abilities. I am reading a file into array like this:
@list=<file>
Then indexing each line of array by $list[0..9] etc, and when I match it against a pattern, the $list[0] includes \n character, hence the match fails. So if ($string =~ $list[0]) fails though without \n character in pattern it would match.
How do I tell pattern matcher to not consider the \n character from pattern?
Thanks
You can shave the line ends from the array after reading:
Now
@linescontains the lines without line ends. Seeperldoc chompfor details.