I have create a simple perl script to use Regex and extract a value from the text file. I have used windows to develop this script and it is working fine in windows
use strict;
use warnings;
use File::Slurp;
my $content = read_file("config.ini");
my $lin_targetdir = $1 if $content =~ m/targetDirectory\s*=\s*(.*)/;
print($lin_targetdir); # /opt/mypath in linux i am getting this output
and my config is
[prdConfig]
IP = xxxxxx
UserID = yyyyyy
password = "zzzzzzz"
targetDirectory = /opt/mypath
however when i run the above in Linux (centos 7) the script is not printing the value. What went wrong in my code ? Can you please help me ?