masterginyu
New member
I have a perl script that reads in a config file for a file moving script I am building. The config file is formated like:
/path/to/files/inbound | /path/to/files/outbound | [email protected]
The code below is what I am trying to use the read the file and split out the sections into variables.
open(MOVECONFIG, 'move.conf') || die "Cound not open move.conf: $!\n";
while (<MOVECONFIG>) {
chomp;
next if (m/^$/); # Skip empty lines
next if (m/^\s*#/); # Skip comments
($inputDir, $outputDir, $email) = split("|");
print "$inputDir \t $outputDir \t $email\n";
}
close (MOVECONFIG);
When this code runs it doesn't split out the elements right, but instead it splits it out like an undef value. Can someone provide me with a solution that will let me parse out those directory paths?
/path/to/files/inbound | /path/to/files/outbound | [email protected]
The code below is what I am trying to use the read the file and split out the sections into variables.
open(MOVECONFIG, 'move.conf') || die "Cound not open move.conf: $!\n";
while (<MOVECONFIG>) {
chomp;
next if (m/^$/); # Skip empty lines
next if (m/^\s*#/); # Skip comments
($inputDir, $outputDir, $email) = split("|");
print "$inputDir \t $outputDir \t $email\n";
}
close (MOVECONFIG);
When this code runs it doesn't split out the elements right, but instead it splits it out like an undef value. Can someone provide me with a solution that will let me parse out those directory paths?