in reply to Re^4: My code sucks, please help me understand why.
in thread My code sucks, please help me understand why.
It's clear that the example data you gave us doesn't give any matches, but if I modify it a bit I do get a match.
Code:
use strict; use warnings; use autodie; open my $pids, '<', 'pids'; my %ids; while (my $line = <$pids>) { chomp $line; my (undef, $id) = split /\|/, $line; $ids{$id} = 1; } close $pids; open my $fids, '<', 'fids'; while (my $line = <$fids>) { my ($id, $rest) = split /;/, $line, 2; if ($ids{$id}) { print "Found id '$id' in line $line"; } } close $fids;
FIDS:
810000001;08/17/1957 810000002;12/02/1975 810000003;12/22/1982 810000004;11/01/1967 810086196;02/07/1981 810000006;12/27/1967 810000007;05/09/1981 810000008;05/14/1976 810000009;10/24/1981 810000010;11/17/1943
pids (unchanged):
dn: cn=*****,ou=users,|810221480 dn: cn=*****,ou=users,|810039655 dn: cn=*****,ou=users,|810086196 dn: cn=*****,ou=users,|810008482 dn: cn=*****,ou=users,|810224329
|
|---|