in reply to Test for newline

Use ^ and $

It'll match only \n contains

$discovered[$i] =~ "^\n$";

Replies are listed 'Best First'.
Re^2: Test for newline
by betterworld (Curate) on Feb 19, 2005 at 13:57 UTC
    This is not exactly the right thing, as /^\n$/ matches both "\n" and "\n\n". Use \z rather than $, or, better, use eq.