in reply to hash jerkin

open A, "<fileA" || die $!; open B, "<fileA" || die $!; open OUT, ">fileAtmp" || die $!; my ($bufA, $bufB); while ($bufA = <A>) { $bufB = <B> || last; #jump out if file B is shorter than A my @A = split ':', $bufA; my @B = split ':', $bufB; print OUT $bufA if $A[0] eq $B[0]; } close A; close B; close OUT;
The rest is left as an exercise for the reader. You should get the gist.

Replies are listed 'Best First'.
Re: Re: hash jerkin
by Fletch (Bishop) on Feb 12, 2003 at 04:36 UTC
    open A, "<fileA" || die $!;

    Aherm, ITYM or not ||. Precedence matters.