in reply to random search in file
my $id = 'data4'; my $result; while (<$fh>) { /^\Q$id\E\s/ or next; ($result) = /\s(\S+)$/; last; } die "not found" if !defined($result); [download]