in reply to Re: Insert lines into specific stanza line
in thread Insert lines into specific stanza line

The second one is correct for what I am trying to accomplish. However I am getting the dreaded Use of uninitialized value in pattern match (m//)

here is my code

if ($change[$i] =~ /\b$ip\b/){ my $seen = 1; if ($seen && m{</stanza>}){ print $tl[0]; $seen = 0; }

What am I missing?

Replies are listed 'Best First'.
Re^3: Insert lines into specific stanza line
by oko1 (Deacon) on Aug 14, 2010 at 00:03 UTC

    Please show enough code to establish context. I suspect that you're failing to define $ip (that's the only variable I see being used in a regex, and so the only place where you could have an uninitialized value in one), but since you've only showed this tiny snippet, there's no way for me to tell what else is wrong. There may also be other things wrong with your script, and I don't want to shoot in the dark.


    --
    "Language shapes the way we think, and determines what we can think about."
    -- B. L. Whorf