in reply to Clearing lines in a file based on an array containing the lines

Perhaps this will work better for you (UNTESTED):

sub GROOMLDIF { # Delete LDAP-internal fields my $erasethese = qr/\A(?:structuralObjectClass|entryUUID|creatorsN +ame|modifiersName|createTimestamp|modifyTimestamp|entryCSN):/; open my $IN, '<', 'data/all.ldif' or die "Cannot open 'data/a +ll.ldif' $!"; open my $OUT, '>', 'data/groomed.ldif' or die "Cannot open 'data/g +roomed.ldif' $!"; while ( <$IN> ) { print $OUT $_ unless /$erasethese/; } }
  • Comment on Re: Clearing lines in a file based on an array containing the lines
  • Download Code