in reply to Re^2: can I make my regexp match first pattern instead of last?
in thread can I make my regex match first pattern instead of last?

Use the string as a file:

my $fileContents; open my $scan, '<', \$fileContents; while (defined (my $block = <$scan>)) { ... } close $scan;

Perl reduces RSI - it saves typing

Replies are listed 'Best First'.
Re^4: can I make my regexp match first pattern instead of last?
by kleucht (Beadle) on Oct 25, 2008 at 22:39 UTC
    It's working! Thanks for the help!
Re^4: can I make my regexp match first pattern instead of last?
by kleucht (Beadle) on Sep 18, 2009 at 15:24 UTC
    Using the string as a filehandle works fine. But now I get a runtime error that says "Can't use string ("") as a symbol ref while "strict refs" in use"

    on this line of code:

    open $ResultsHandle, '<', \$return;

    So how can I use strict, which is required by Perl Best Practices, and process a multi line string one line at a time?

    Thanks, Kurt

      Go here for the clear version of the question (and answers, too).