Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Really V.V.Easy Question.

Posted on 1998-11-10
4
Medium Priority
?
228 Views
Last Modified: 2010-03-04
I need to execute DIR/W from my perl script and send the output to a file -not to the scren-.Can you help please. Thanx.


0
Comment
Question by:Paris
  • 2
  • 2
4 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 1206137
print FILE `DIR/W`;
0
 
LVL 1

Accepted Solution

by:
flivauda earned 200 total points
ID: 1206138
open(LS, "dir /w c:\mypath |");
open (OUTFILE, "out.txt");
while ($ln = <LS>)
{
  print OUTFILE "$ln";
}
close (LS);
close (OUTFILE);

0
 
LVL 85

Expert Comment

by:ozo
ID: 1206139
#that's equivalent to
open(LS, "dir /w c:mypath |");  #quoting the "m" with "\m" does nothing
open (OUTFILE, "<out.txt");  #you are opening OPTFILE for reading, not writing
while( <LS> ){
  print OUTFILE;  #quoting "$in" is unnecessary, it's the same as printing $in
}
0
 
LVL 1

Expert Comment

by:flivauda
ID: 1206140
I know that you dont have to assign it to anything I jsut like having access to my variables, in case I want to change it later on, so it is just habit
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question