My sub info is as below:------------------------------------ This is perl, v5.8.4 built for sun4-solaris-64int (with 27 registered patches, see perl -V for more detail) Copyright 1987-2004, Larry Wall ------------------------------------
#-----Extract Moved Users-----# sub ExtractUsers { my $foundUser = "n"; my $foundDN = "n"; my $matchUser = -1; my $foundOrg = -1; my $lenLine = 0; my $readLine = 0; my $foundFirst = "n"; my $totalFound = 0; my $statusLine = 0; my $myArray = 0; print "ExtractUsers\n"; open(FILE, "< $backupPathDir") or die "Can't Find or Open +$backupPathDir: $!"; # File output - writing to print "backupPathDir: $backupPathDir\n";; open(NEW, "> $ldap_move_file") or die "can't open $ldap_mo +ve_file: $!"; print "ldap_move_file: $ldap_move_file\n"; while (<FILE>) { # Good practice to store $_ value because # subsequent operations may change it. my($line) = $_; # Good practice to always strip the trailing # newline from the line. chomp($line); #print "line = $line\n"; ++$readLine; ++$statusLine; if ($statusLine eq 20000) { print "Processing Lines: $readLine\n"; $statusLine = 0; } $lenLine = length($line); #print "lenline = $lenLine\n"; # Skip if found blank line and also statement with line id "en +try-id" if (($lenLine > 1) && (index($line,'entry-id') eq -1)){ # checking whether the line contains o=mail,dc=company,dc= +com $foundOrg = index($line, $org_suffix); if ($foundOrg > 0) { $foundUser = "n"; $foundDN = "y"; if ($totalFound eq scalar(@userArray)) { exit (0); } } #print "FoundOrg = $foundOrg\n"; #print "foundDN = $foundDN\n"; if ($foundDN eq "y") { $line =~ s/People/$move_suffix/g; #print "***Line = $line\n"; #$userArray = @userArray; foreach $myArray (@userArray) { #$userArray =$_; #print "userArray = $userArray\n"; $matchUser = index($line, $myArray); #print "matchuser = $matchUser\n"; if ($matchUser > 0) { if ($foundFirst eq "y") { # Insert a blank line after each users but + not for first found user (print NEW "\n") or die "can't write to + $ldap_move_file: $!"; } (print NEW $line . "\n") or die "can't writ +e to $ldap_move_file: $!"; $foundFirst = "y"; $foundUser = "y"; ++$totalFound; } else { $foundDN = "n"; } } } else { if ($foundUser eq "y") { if (index($line, "nsUniqueId") eq -1) { (print NEW $line . "\n") or die "can't writ +e to $ldap_move_file: $!"; } } } } } close(FILE) or die "can't close $backupPathDir: $ +!"; close(NEW) or die "can't close $ldap_move_file: $ +!"; my $test = `rm $backupPathDir`; my $logfile = $step1_logfile . `date '+%m%d%Y'`; chomp ($logfile); $logfile = "$logfile" . "." . $step1_log_ext; print "OutputLog: $logfile\n"; open(READ, "< $ldap_move_file") or die "Can't Find or Open + $ldap_move_file: $!"; # Appending TO the Log files open(WRITE, ">> $logfile") or die "Can't Find or Open $log +file: $!"; print WRITE "**Step #5 Creating a Move User LDIF File\n"; print WRITE "========================================\n"; while (<READ>) { # Good practice to store $_ value because # subsequent operations may change it. my($line) = $_; # Good practice to always strip the trailing # newline from the line. chomp($line); print WRITE "$line\n"; } print WRITE "\n"; close(READ) or die "can't close $ldap_move_file: +$!"; close(WRITE) or die "can't close $logfile: $!"; }
Please note that from the line beginning with the command below onwards the lines have been skipped. I am still very confused why this is happening? How do I track it?#--Loading of parameters from deprovision.cfg--# LoadConfigParam; ExtractParameterStep1; PrintBanner; # Reading input file - reading from if (-e $verified_working_file) { ContinueYesNo; if ($answer eq "y") { #--Run DB2LDIF Before Changes--# $b4_after_status = $db2ldif_after_ext; Db2Ldif; ValidUserArray; ExtractUsers; PrintSummary; } }
my $test = `rm $backupPathDir`;
Edit: g0n - readmore tags
In reply to Why my perl script skip my some of the executed lines even without using conditions?? by fabster01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |