Reputation:
So I encountered an issue with duplicate value.
$pdftitle = $2;
$cleantitlepdf = substr($pdftitle , 0, 30 );
$cleantitlepdf =~ s/[^a-zA-Z0-9]//gmis;
$uidname = $cleantitlepdf."UIDUL";
basically the $uidname has some duplicate value what I needed to do is not to remove the duplicate but to rename it so it will have its own unique name. so just for example.
$uidname = 04042020AmendmentUIDUL - There are 3 of this on the $uidname what I want is something like this.
04042020AmendmentUIDUL
04042020AmendmentUIDUL1
04042020AmendmentUIDUL2
Something like this? so they can have their own unique name. I'm not good with perl if anybody could help me on this I would greatly appreciate it.
Upvotes: 0
Views: 73
Reputation: 385657
my %next_ids;
while (...) {
...
my $uidname = $cleantitlepdf."UIDUL";
$uidname .= $next_ids{ $uidname }++ // '';
...
}
Upvotes: 2