in reply to Re: Weird printing
in thread Weird printing

I have to take issue with your
$cat2 = `/bin/cat data.txt`;
Try undefing the record separator then read in the file from a normal filehandle.
open(FH, 'data.txt') or die(); my $tmp_fs = $/; my $cat2 = <FH>; $/ = $tmp_fs; close(FH);

Replies are listed 'Best First'.
RE: RE: Re: Weird printing
by chromatic (Archbishop) on Aug 10, 2000 at 00:12 UTC
    local will do this for you automatically, if you scope it correctly:
    my $cat2; { open(FH, 'data.txt') || die "Some error: $!"; local $/; $cat2 = <FH>; close FH; }
    You have to make sure $cat2 is defined outside of the block, though, otherwise it'll go out of scope when you want to use it.