Hello,
I'm using Perl on Windows to read in a file as such:
APPLS\UTILITY\NOV2WIN mtuser:RXL
I read in the entire file full of these and put them into an array (@array).
if I do a "Print @array\n"; all of the backslashes that were in the text file are intact.
I however cannot seem to find a way to get them out of the array and intact for manipulation, printing, etc.
Any help appreciated *scratching head* I've thought about a global search replace on backslashes or something but I can't help but think I'm missing something obvious.
Script snipit below.
# Special Permissions Perl Script
$server = $ARGV[0];
$domain = $ARGV[1];
@parts = split(/\./,$domain);
$site = $parts[0];
$root = $parts[1];
$ext = $parts[2];
# MAIN
open (MODIN,"mods.txt"
while ($linein = <MODIN>){
chomp $linein;
print "$linein\n"; # Still has backslashes!
push (@array, $linein);
}
print "@array\n"; # hey, its got backslashes!
while ($line = <@array>){
$line= "\\\\$server\\".$line;
print "$line \n"; # Backslashes gone!
}
close (MODIN);
-------------
mod.txt:
APPLS\UTILITY\NOV2WIN mtuser:RXL
APPLS\UTILITY
APPLS\UTILITY\GENERAL\PCTRACKER
APPLS\SWITCH_H
APPLS\NADMIN
I'm using Perl on Windows to read in a file as such:
APPLS\UTILITY\NOV2WIN mtuser:RXL
I read in the entire file full of these and put them into an array (@array).
if I do a "Print @array\n"; all of the backslashes that were in the text file are intact.
I however cannot seem to find a way to get them out of the array and intact for manipulation, printing, etc.
Any help appreciated *scratching head* I've thought about a global search replace on backslashes or something but I can't help but think I'm missing something obvious.
Script snipit below.
# Special Permissions Perl Script
$server = $ARGV[0];
$domain = $ARGV[1];
@parts = split(/\./,$domain);
$site = $parts[0];
$root = $parts[1];
$ext = $parts[2];
# MAIN
open (MODIN,"mods.txt"
while ($linein = <MODIN>){
chomp $linein;
print "$linein\n"; # Still has backslashes!
push (@array, $linein);
}
print "@array\n"; # hey, its got backslashes!
while ($line = <@array>){
$line= "\\\\$server\\".$line;
print "$line \n"; # Backslashes gone!
}
close (MODIN);
-------------
mod.txt:
APPLS\UTILITY\NOV2WIN mtuser:RXL
APPLS\UTILITY
APPLS\UTILITY\GENERAL\PCTRACKER
APPLS\SWITCH_H
APPLS\NADMIN