?
Solved

Really V.V.Easy Question.

Posted on 1998-11-10
4
Medium Priority
?
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 84

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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
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

770 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