chen li wrote:
Hi all, When I run scripts I want the result saved to a different directory instead of the current one on window xp. What is the code for this from the window promt(not within the script itself)? c:\>perl test.pl >1(this will save the result in the current directory. How about saving the result to c:/perl/self/?)
Your example saves the output in a file called '1'; presumably you knew that. But Windows would be a lot happier with it being called '1.txt' so that it knew what sort of contents it had and could default to using notepad (or something) to open it. Even better, so that /you/ knew what the contents were you could call it 'test-out.txt'. But on to your question... You can specify a path on the command line as well as an output file name, like this: C:\>perl test.pl > C:\perl\self\test-out.txt (Note that you need to use backslashes in the path on the command-line as the command prompt shell isn't as forgiving as Perl!) or you can reopen STDOUT within the program so that you don't have to redirect it on the command line: open STDOUT, '>', 'C:\perl\self\test-out.txt' or die $!; (Either forward or backward slashes will do here.) HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>