Rod Za <[EMAIL PROTECTED]> wrote:
: --- "Charles K. Clarkson" <[EMAIL PROTECTED]> wrote:
:: next unless
:: /^
:: \Q$printer\E-
:: (\d+)\s+
:: (\w+)\s+\d+\s+\w+\s
:: (\d+\s\w+\s\d+\s\d{2}:\d{2}:\d{2})
:: /ox;
:
: What the \Q \E /ox in the regex does?
The \Q and \E do the same thing as the 'quotemeta' function
in perl. See perlfunc.
/o at the end of a regex tells perl that the variable(s)
contained within do not change on each pass. See perlre.
/x at the end of a regex tells perl to ignore white space
added to the regex. See perlre.
Thus:
/^\Q$printer\E-(\d+)\s+(\w+)\s+\d+\s+\w+\s(\d+\s\w+\s\d+\s\d{2}:\d{2}:\d{2})
/o;
is equivalent to:
/^
\Q$printer\E-
(\d+)\s+
(\w+)\s+\d+\s+\w+\s
(\d+\s\w+\s\d+\s\d{2}:\d{2}:\d{2})
/ox;
The second regex still compiles and is (IMO) easier to read.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>