in reply to Golf: Files Containing a Pattern

# 1 2 3 #234567890123456789012345678901234 grep{open F,$_;grep/$_[0]/,<F>}<*>
Update:
# 1 2 3 #2345678901234567890123456789012 grep{@ARGV=$_;grep/$_[0]/,<>}<*>
Has caveats of course..

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Golf: Files Containing a Pattern
by Pug (Monk) on Oct 18, 2002 at 22:55 UTC
    Changing your 2nd grep to a map saves 1.
    #234567890123456789012345678901234 grep{open F,$_;map/$_[0]/,<F>}<*>
    --
    Pug
      Getting a little crazy can save three more strokes:
      grep{open _,$_;map/@_/,<_>}<*>
      Not much wiggle room left, I think.
        Untested, but should work in theory ...
        grep{open _;map/@_/,<_>}<*>
        And that's another three off.

        _________
        broquaint