in reply to weird problem
my $file = 'myfile.txt'; my $txt = do { local (@ARGV, $/) = $file; <> }; $txt =~ s/[\r\n]/ /g; $txt =~ s/ /rand() < 0.5 ? q{ } : "\n"/eg; open(my $fh, '>', $file) or die "$0: Can't open $file for write: $!"; print $fh $txt; close $fh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: weird problem
by Anonymous Monk on Apr 21, 2012 at 08:49 UTC |