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
Tom Phoenix wrote:
> On 8/5/06, Peter Daum <[EMAIL PROTECTED]> wrote:
>> $s =~ /^(.*[^\\])(\\)?$/; print "1: '$1', 2: '$2'";
>
> Let's see what that pattern matches by annotating it:
>
> m{
>^ # start of string
>( # memory 1
> .*# any ol' junk, including backslashes
On 8/5/06, Peter Daum <[EMAIL PROTECTED]> wrote:
$s='abc \
';
$s =~ /^(.*[^\\])(\\)?$/; print "1: '$1', 2: '$2'";
Let's see what that pattern matches by annotating it:
m{
^ # start of string
( # memory 1
.*# any ol' junk, including backslashes
[^\\] # any n
Peter Daum am Samstag, 5. August 2006 18:45:
> Hi,
Hallo Peter
> 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 \
>
Hi,
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 the line