Gunnar Hjalmarsson wrote:
JupiterHost.Net wrote:
you likely need the multi line switch. change this:
my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/i;
to:
my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/si;
The /s makes it match through multi lines.
No, no, your understanding of the /s modifier appears to be a misconception.
It changes '.' to match any character, even a newline, which normally it would not match. Since there is no '.' in the above regex, the /s modifier does not make a difference. See "perldoc perlre".
I was referring to the part of perldoc perlre that says "s Treat string as single line. ..." and then goes on to describe how that works in more detail.
It may or may not make a difference depending on the data given and the regex of course but since the string seemed to be a multiline string it might be best to treat it as such just in case the regex is really only grabbing data from the first line of the string for some reason. Which it seemed to be doin since the example where it didn't return anything the desired data was in the 2nd and 3rd line and when it did return data it was in the 1st line. At least that is what it appeared from what was described in the post.
Lee.M - JupiterHost.Net
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>