in reply to Re: Re: Golf: Files Containing a Pattern
in thread Golf: Files Containing a Pattern

Getting a little crazy can save three more strokes:
grep{open _,$_;map/@_/,<_>}<*>
Not much wiggle room left, I think.

Replies are listed 'Best First'.
Re: Re^3: Golf: Files Containing a Pattern
by broquaint (Abbot) on Oct 19, 2002 at 18:23 UTC
    Untested, but should work in theory ...
    grep{open _;map/@_/,<_>}<*>
    And that's another three off.

    _________
    broquaint

      I had no idea that my attempt at obfuscation would actually lead to something, as I was just using underscore as a variable name to amuse myself. From open:
      If EXPR is omitted, the scalar variable of the same name as the FILEHANDLE contains the filename. (Note that lexical variables--those declared with "my"--will not work for this purpose; so if you're using "my", specify EXPR in your call to open.) See the perlopentut manpage for a kinder, gentler explanation of opening files.