You're welcome. However, it is unclear to me why, given you want to use regexp matching, your regexp match apparently does not work and exact equality does:
if ($mymobi =~ m/($myepub)/) {print "DUPLICATE FOUND !\n" ; &movetodir($myfilt,$dupdir ); } #Does NOT work if ($mymobi eq $myepub) {print "DUPLICATE FOUND !\n" ; &movetodir($myfilt,$dupdir ); } #Works
The regexp will match anything containing your title, so for a title like "blert" you will be matching all of "blert", "blertblartblort", "foobarblertbaz" etc. Perhaps you need to filter the file names for possible partial matches when you read them? Or if you know there are spelling errors then have a look at Text::Fuzzy and similar. Even then you would perhaps be best to flag them somewhere for cleanup or modification before automated processing.
Some other points are:
There is no need to call your subroutines using the &foo() notation unless your perl is very old. foo() will work fine in your case.
You seem not to really be using subroutine signatures, so
sub typefiles( $tfile , $filetype ) { ($tfile, $filetype ) = @_ ; #etc... }
can simply be
sub typefiles { ($tfile, $filetype ) = @_ ; # etc... }
In reply to Re^3: Duplicates in Directories
by swl
in thread Duplicates in Directories
by kel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |