in reply to How to match a ;

That matches strings where the only character on the line is a ';'. To match just the first character where you don't care what follows, omit the $.


Perl's payment curve coincides with its learning curve.

Replies are listed 'Best First'.
Re^2: How to match a ;
by AnomalousMonk (Archbishop) on Feb 08, 2009 at 09:57 UTC
    The regex of the OP will evaluate true for all strings except a string consisting of a single ';' character optionally followed by a newline because  $line !~ m{^;$} uses the  !~ negating binding operator.

    Update: corrected per GrandFather's reply below.

      Argh! Quite right. It must be the heat here!

      Well, any string except one containing a single ';' optionally followed by a \n.


      Perl's payment curve coincides with its learning curve.