in reply to Re: Regex returns match the first time. It returns everything thereafter
in thread Regex returns match the first time. It returns everything thereafter

Nope, any empty line will match '/^\z/' and stop the flip-flop.

There is no end-of-array test possible in a foreach-loop, so no useful flop-condition.

Using a flip-flop here is nonsense.

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re^2: Regex returns match the first time. It returns everything thereafter

Replies are listed 'Best First'.
Re^3: Regex returns match the first time. It returns everything thereafter
by guitarplayer68 (Novice) on Nov 18, 2013 at 13:29 UTC

    Hi Rolf,
    What would you suggest I use?

      Something like this should work:

      my $found=0; print grep { $found or ( /line/ and $found=1 )} @ssh;

      Aaron B.
      Available for small or large Perl jobs and *nix system administration; see my home node.