On Sun, 9 Feb 2003 12:34:38 +1100 (EST), [EMAIL PROTECTED] wrote:
>Yitzchak Scott-Thoennes  wrote:
>>     chomp(my $tmp=$x); my @lines=split /\n/,$tmp,-1
>
>This one fails for the case $x = "\n"; @lines should contain one
>empty element, but the code above contains none.

Sigh.  I'd call that a bug if someone hadn't gone to the trouble to
test for it and document it.  (Indeed, I see a bug report out there:
#6653, was 20010327.008.) So do something like:

my @lines;
chomp(my $tmp=$x);
@lines = split /\n/,$tmp,-1 or @lines=""

Reply via email to