by perl 1 min read

Perl slurping

It seems like whenever I go to slurp in a whole file into a string in Perl, I have to search around to remember the exact syntax. So I decided to put it here for myself, so I won’t have to search any further than my own site. In this particular instance, I am trying to remove any <span> blocks from a file. I can simply do the following:
perl -e '$string = do {local( $/ ); }; $string=~s/.*?//gs; print $string;' outfile