($a,$b)=split(/\s/,$test1,2); print "b=$b\n"; #### use strict; my $target; open( I, "file1" ) or die "file1: $!"; while () { if ( /^apple\s+(.*)/ ) { $target = $1; # note: .* does not match line terminators last; } } close I; my $found; open( I, "file2" ) or die "file2: $!"; while () { if ( /^$target\s+(.*)/ ) { $found = $1; last; } } close I; print "found: <<$found>>\n";