I am in charge of upgrading this Perl script from Perl v5.6.1 (2001) to v5.20.2 (2015). I have these 2 regex variable:
foreach (@filelist) {
chomp;
my $File = $_;
if ( $File =~ qr/.+/o ) {
if ( $BaseLine ) {
$BaseLineRegExpA = qr/^\Q$BaseLine\E\\/io; #these 2 regexes
$BaseLineRegExpB = qr/^\Q$BaseLine\E;/io; #these 2 regexes
if ( $File =~ /$BaseLineRegExpA/ ) {
#...
} elsif ( (!($File =~ /$BaseLineRegExpB/)) && (!(lc( $File ) eq lc( $BaseLine ) )) ) {
$BaseLine = $File;
}
}
}
}
So, I have 2 questions:
In the old Perl version, the
$BaseLineRegExpAand$BaseLineRegExpBgets reevaluate every time$BaseLinechanges, but in the new Perl, it does not. How do I make it changes? I've tried my$BaseLineRegExpA, it still does not change.In the old Perl,
$BaseLineRegExpAevals to:(?i-xsm:^F:\\dd\\), and in the new Perl, it evals to(?^i:^F:\\dd\\). My questions is, is there a different between?i-xsm:^and?^i:^?
Thanks so much, unfortunately, these are legacy scripts and I don't know much about Perl.