#!d:\perl\bin\perl.exe sub initials { $ComDir='.\\'; $Inputfile='ProxyFTP'; $Outputfile='ftpreport.txt'; $Permsfile='userperms.txt'; } sub datacollect { open(PERF, "<$ComDir$Permsfile") || die ("died opening source file $Permsfile") ; # Open the file @plines = ; chop (@plines); close(PERF); $pmax=scalar (@plines); } sub cleanupline { my($linein) =@_ ; $linein =~ s/[\n\r]//g, $linein; $linein =~ s/^[ \t]+//g,$linein; $linein =~ s/[ \t]+/ /g, $linein; } $ComDir='.\\'; &initials; &datacollect; open(NUREP, ">$Outputfile") || die ("died opening $Outputfile file") ; for($pindex=0; $pindex<$pmax; $pindex++) { # build permissions hash $plines[$pindex]=&cleanupline($plines[$pindex]); ($name,$value) = split/ /, $plines[$pindex],2; $name{$value}=1; } # next 3 lines should print Exists $nam='sapuser'; $val='1.2.3.4'; print "Exists\n" if exists $nam{$val}; # next 3 lines should not print Exists $nam='sapuser'; $val='1.2.3.7'; print "Exists\n" if exists $nam{$val}; close(NUREP);