On Fri, 7 Feb 2003 15:05:47 +0100, [EMAIL PROTECTED] wrote:
>Not if the last line did not end with a record separator.
>His example data did, but other data might not.

In general, I'm all in favor of coding charitably toward files w/o a
trailing newline.  Here, however, the OP wants to convert data between
two forms, one of which doesn't have any way to store a 'final newline
missing' flag.  Hence, this problem can't have a solution that allows
that distinction.  The best that can be done is to make allowances for
the situation on the scalar->list side only, e.g. (untested):
    chomp(my $tmp=$x); my @lines=split /\n/,$tmp,-1
instead of:
    my @lines=split /\n/,$tmp,-1; pop(@lines);

Reply via email to