Do you mean "why we have used"? I fear it is up to you to know. Or, do you mean "why we have to use"? Well, you do not have to. But it is a good practice, because without localizing $/, processing of a different file in a different part of the code can break. See also Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };.