in reply to Array Search

Solution using the postmatch variable $' ...

open FH, $filename || die $!; foreach (<FH>) { next unless $_ =~ /--from/; print $'; }; close FH;

Update - Removed the conditional 'untested' from the term solution

 

Ooohhh, Rob no beer function well without!

Replies are listed 'Best First'.
Re: Re: Array Search
by pike (Monk) on Nov 14, 2001 at 14:49 UTC
    Either

    open FH, $filename or die $!;

    or

    open (FH, $filename) || die $!;

    but with your variant you'll never see the error message (operator precedence).

    Sorry to be nitpicking, but I stumbled over that one myself once...

    pike