I have a subroutine that I would like to run against two data sources and print to different lexical filehandles depending on the original entry point (the routine recurses through Active Directory trees).
open($eis_fh, ">", "EIS.txt") or die "no handle to write EIS users";
Roundup($EIS_O, $eis_fh);
sub Roundup {
my ($root, $fh) = (@_);
foreach (in $root) {
my $thing = $_;
if ($thing->{class} eq 'organizationalUnit') {
my $thong;
foreach (in $thing) {
$thong = $_;
Roundup($thong);
}
}
elsif ($thing->{class} eq 'user') {
my $string;
$string .= $thing->{employeeID};
$string .= "\t" ;
$string .= $thing->{sAMAccountName} ;
$string .= "\t" ;
$string .= $thing->{department} ;
$string .= "\t" ;
$string .= $thing->{o} ;
$string .= "\t" ;
$string .= $thing->{physicalDeliveryOfficeName} ;
$string .= "\n";
print { $fh } $string;
}
else {
}
}
}
does not work. What am I overlooking?