Newbie to perl scripting. I am trying to read a file and append some test to it. my code works fine on windows but behaves very differently on Linux.
use strict; sub main{ my $configFile="/home/testuser/perl/config.properties"; #my $configFile="C:/Projects/perl/win_config.properties"; my $rootLoc ="NA"; if(-e $configFile){ # Open file to read if(open(DATAP, "<$configFile")){ # iterate through index file. while(<DATAP>){ my @splitLine = split('=', $_); if($splitLine[0] eq "rootLoc"){ chomp $splitLine[1]; $rootLoc = $splitLine[1]; } } #close data file. close( DATAP ); } } else{ print "***Config file does not exist***\n"; } print "\$rootLoc -> $rootLoc \n"; if(!($rootLoc eq "NA")){ my $srcDirectory = $rootLoc . "src/*"; my $srcWorkDir = $rootLoc . "work/"; my $procDir = $rootLoc."processed/"; my $errDir = $rootLoc."error/"; print "$srcDirectory\n"; print "$srcWorkDir\n"; print "$procDir\n"; print "$errDir\n"; } } main();
Output on windows:
but out put on Linux:$rootLoc -> C:/Projects/perl/output/ C:/Projects/perl/output/src/* C:/Projects/perl/output/work/ C:/Projects/perl/output/processed/ C:/Projects/perl/output/error/
What am i doing wrong...rootLoc -> /home/testuser/perl/ src/*/testuser/perl/ work//testuser/perl/ processed/user/perl/ error/testuser/perl/
/home/testuser/perl/src/* /home/testuser/perl/work/ /home/testuser/perl/processed/ /home/testuser/perl/error/
In reply to Script behaving differently on Linux vs windows by venu2016
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |