I think that @stark is right, your problem is with newline characters. chomp
will remove any trailing string corresponding to the special variable $/
, which is different on Windows and Linux. You can get round this problem using a regex instead:
my $content_list = '/home/p12/scripts/list_muni_nav.txt';
print "\t*****************START***************************\n";
print "\tOpening file $content_list\n";
if (open my $fh, "<", "$content_list") {
while (my $line = <$fh>) {
$line =~ s/\s+$//;
print "\t Applying EAs to file $line\n";
my $setEAVersion= "$getAttrib -s TeamSite/Assocation/Version=1 \"$line\"";
`$setEAVersion`;
my $setEADCRType= "$getAttrib -s TeamSite/Templating/DCR/Type=muni_site/nav \"$line\"";
`$setEADCRType`;
my $setEAFormValid= "$getAttrib -s iw_form_valid=true \"$line\"";
`$setEAFormValid`;
print "\t EAs applied successfully to $line\n";
print "\t**********************************************************\n";
}
The s/\s+$//
regex removes all whitespace characters from the end of the line.
As a bonus, I changed your open
so that it uses the three argument version and I also changed your while
loop to avoid code repetition.