Solved

Really V.V.Easy Question.

Posted on 1998-11-10
4
166 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 84

Expert Comment

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

Accepted Solution

by:
flivauda earned 50 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 84

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now