in reply to Re: working with non-delimited files
in thread working with non-delimited files

You've overwritten $_

Try

while (my $data = <DATA>) { $data =~ s/\s+/\|/ for 1..5; print $data; }
Edit: Damn. Too Slow.

Replies are listed 'Best First'.
Re^3: working with non-delimited files
by blazar (Canon) on May 24, 2007 at 21:50 UTC
    Edit: Damn. Too Slow.

    You're right: I updated my node and said so. Then the update was wrong too, and I made a further update silently, in the hope that no one would notice... ;-) Of course you solution with split is far better, except that even for such a tiny thing I would use while instead of for. Until we're in full Perl 6 times, that is...