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
No sample data means no solution. Here's the SSCCE you could have provided:
use strict;
use warnings;
use Test::More tests => 2;
my $mymobi = 'Hello World!';
my $myepub = 'Hello World!';
ok ($mymobi =~ m/($myepub)/);
ok ($mymobi eq $myepub);
See how both the string equality and the regular expression matches are true? So they both "work". Your task is now to provide the values for $mymobi and $myepub for which one or other doesn't match. At that point it should become clear to you what the difference between an exact string match and a regular expression match is (and why one or the other is preferable in different situations - because they serve different purposes).