in reply to Pattern problem

Why
$text =~ /Host System (?!#)/
??

Correct:
$text =~ /Host System [^#]/

Replies are listed 'Best First'.
Re^2: Pattern problem
by ikegami (Patriarch) on Jan 27, 2006 at 18:51 UTC

    $text =~ /Host System (?!#)/ is correct too. However, [^#] is probably faster and an acceptable replacement in this case.

    The problem is
    if $text =~ /Host System (?!#)/ next;
    was used instead of
    if ($text =~ /Host System (?!#)/) { next; }
    or
    next if ($text =~ /Host System (?!#)/);
    or
    next if $text =~ /Host System (?!#)/;