I can never be bothered to remember how to slurp files. And I don't have to because File::Slurp remembers for me.
use File::Slurp; my $data = File::Slurp::read_file('filename'); $data =~ s/\015?\012//g;
Some people will wonder why I bother to use a module to handle a concept that can be written in only a couple lines of code, but I know that File::Slurp will always 'Do the Right Thing', whereas I have been known to make silly little mistakes (I always used to get $| confused with $/).
In reply to Re: How to slurp files and join lines
by cees
in thread How to slurp files and join lines
by alecclews
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |