in reply to Re: Re: Grep file before sending through socket
in thread Grep file before sending through socket

I was wondering if you could help me interpret the following line.   my $file = do { local $/; <FILE> }; This is called "slurp mode". Setting $/ to undef means that the entire file will be read. Localizing $/ within a short-lived scope both sets $/ to undef, and ensures that it will be restored on scope exit.

This is equivalent in effect to writing   my $file = join('', <FILE>); but without the extra overhead to build up a temporary array and set of strings to populate it with.