R
Ronny
My perl is 5.8.3, and when I execute the following program:
#!/usr/local/bin/perl -ws
use strict;
"dummy" =~ /
first|
second| # this comment has a/slash
third
/x;
I get the error message:
Bareword found where operator expected at ./matcherr.pl line 5, near
"second| # this comment has a/slash"
(Might be a runaway multi-line // string starting on line 3)
The reason is the '/' in the comment. If I change the line to:
second| # this comment has no slash
the program runs fine. This surprises me, because as I have understood
the
'x' modifier, a comment within the pattern should eat up everything
until the
end of the line. Seemingly, parsing for the terminating "/" happens
BEFORE
white space inside the pattern is removed. Or did I misunderstand
something
here?
Ronald
#!/usr/local/bin/perl -ws
use strict;
"dummy" =~ /
first|
second| # this comment has a/slash
third
/x;
I get the error message:
Bareword found where operator expected at ./matcherr.pl line 5, near
"second| # this comment has a/slash"
(Might be a runaway multi-line // string starting on line 3)
The reason is the '/' in the comment. If I change the line to:
second| # this comment has no slash
the program runs fine. This surprises me, because as I have understood
the
'x' modifier, a comment within the pattern should eat up everything
until the
end of the line. Seemingly, parsing for the terminating "/" happens
BEFORE
white space inside the pattern is removed. Or did I misunderstand
something
here?
Ronald