in reply to Perl regular expression question

Take a look at perlrequick. It gives you a quick overview of Regular Expressions in Perl. My explanation of your code is as follows:

  1. The m tells perl to start a match.
  2. The | character is used as a delimiter. Using / is normal but any delimiter can be used. If you use / then you don't need to start with an m
  3. The $input is interpolated (The content of the variable is placed in the regular expression)
  4. The o modifier signifies that the regular expression is compiled once. Changing the value in $input will not change your regex.
  5. The whole regular expression is matched against the value held in $_ by default. You would use the =~ operator to match a particular variable.

Replies are listed 'Best First'.
Re^2: Perl regular expression question
by Anonymous Monk on Aug 25, 2005 at 09:17 UTC
    Thank you all for providing such good explanation and providing links for further study .. Thank you very much!!!