I'm trying to come up with a script that will read a list of files from a
text file and copy them from one path to another. I can't seem to get perl
to use the text file as <STDIN> on a Win2000 PC. I call the perl program
from the command line using the < to direct the data file to <STDIN> (i.e.
cp.pl < inputfile.txt). When I don't use the inputfile I can enter <STDIN>
from the keyboard and it works. Also, I can get it to read the file on a
UNIX box. Here's a short sample of the code I'm trying. TIA
Scott Gibson
[EMAIL PROTECTED]
**************************************************************************** ** $DEVSERVER = 'g:\\'; $POSTSERVER = 'h:\\';
while (defined($_ = <STDIN>)) {
You can just write this as while (<STDIN>)
This will store whatever it has read into $_ and will break out the loop on eof
print "This is the path\n" ; print $_ ; print "\n";
print "This is the path\n", $_, "\n"; perldoc -f print (print takes a list of strings to print)
#####Do a directory listing on both paths to verify the; #####modified date on the file.;
system ("dir $DEVSERVER$_");
system ("dir $POSTSERVER$_");
Avoid system if you can. This can be achieved through opendir, readdir and closedir calls.
perldoc -f opendir
perldoc -f readdir
perldoc -f closedir
Another option is to use the glob operator
perldoc -f glob
perldoc File::Glob
#####Copy the file from one path to the other; system ("copy $DEVSERVER$_ $POSTSERVER$_");
perldoc File::Copy
#####Do a directory listing on both paths to verify the; #####modified date on the file changed on the scond path.;
system ("dir $DEVSERVER$_");
system ("dir $POSTSERVER$_");
See above
} **************************************************************************** ***
I don't have an answer to your original question, maybe one of the windows users in this list will have an answer
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]