Perl only matching single-character regex patterns?
I'm having a small issue with regex matching in Perl. I'm pretty certain it's a simple fix, but it all looks correct to me...
Any ideas? If I run the following: Code:
#! /usr/bin/perl Code:
if ($line =~ m/Pro/){ The file I'm reading is: (It has the same effect whether I leave it with Windows linebreaks or convert them to unix). Code:
??System Information report written at: 01/20/09 09:24:45 |
It works fine here. Output:
Code:
telemachus ~ $ ./testing Code:
#!/usr/bin/env perl |
Yeah, I know that bit could be a lot more simple, but it's to be a middle bit in a longer process - I tend to start with the bit that would require the most work, then add the simpler bits (looping through the files, formatting the output) later on. It's going to push the variable if it matches in the end.
But, if it works for you, I'll get cracking on working out what's wrong with mine... |
Just spotted the '??' at the beginning of the file, and the fact it worked for you so copied and pasted the input file into a new one, and it all seems to work.
So I try to grep the first line off it, and get the following: Quote:
Looks like this problem doesn't belong in a programming forum... |
All times are GMT -5. The time now is 05:35 PM. |