Really V.V.Easy Question.

Posted on 1998-11-10
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.

Question by:Paris
  • 2
  • 2
LVL 84

Expert Comment

ID: 1206137
print FILE `DIR/W`;

Accepted Solution

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

LVL 84

Expert Comment

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

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remove Malware code from PHP file 6 74
Can Oracle Client work with an Oracle 12c Database? 5 144
Exchange 2010 Transport Rule Regex 28 95
Perl string filter 5 74
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 …
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

896 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

16 Experts available now in Live!

Get 1:1 Help Now