in reply to count moby substrings

Hi hally. I'm trying to work out why you used the do construct on line 27? Why is that needed as opposed to a bare block with no do? I understand that do can be used with while, or to overide the loop-like nature of bare blocks when used with next or last, neither of which is the case here.

Cheers!

Replies are listed 'Best First'.
Re: Re: count moby substrings
by halley (Prior) on Jul 30, 2003 at 11:46 UTC
    Just a matter of style-- bare braces in the middle of nowhere make me itch, looking for an 'if' line that may have been deleted or obscured. Same reason I explicitly handle newlines and whitespace in two passes, though that's not really necessary.

    --
    [ e d @ h a l l e y . c c ]

      I prefer to write it this way:
      my $input = do { local $/; <> };

      Makeshifts last the longest.