Peter Daum wrote:
> Hi,

Hello,

> when trying to process continuation lines in a file, I ran
> into a weird phenomenon that I can't make any sense of:
> 
> $s contains a line read from a file, that ends with a backslash
> (+ the newline character), so
> 
> $s='abc \
> ';
> 
> $s =~ /^(.*)$/; print $1; # prints "abc \" as expected

If what you really want to do is put all the continuation lines on the same
line then you can do it something like this:


while ( my $s = <FILE> ) {

    if ( $s =~ s/\\\n/ / ) {

        $s .= <FILE>;

        redo;
        }

    # process complete line
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to