Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System("dir"); Output in a variable 2

Status
Not open for further replies.

prateekm21

Programmer
Oct 24, 2007
3
US
Suppose I run the command

system("dir"); or system("ver");
====

How do I get the output data is a Variable?

Thanks :)
 
To Be more precise I need Dos Command output in a variable using Perl :)
 
I prefer the qx// operator for readability:

my $dir = qx/dir/;

it does the same as backtiks.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
is qx identical to backticks or are there any differences.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
As far as i know, backtiks and qx do the exact same thing. qx being a quote operator you can choose a different delimiter to use, but backtiks must be backtiks.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
same answer, qx and backticks, are identical in functionality, but only marginally different in how they're called

qx /STRING/

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top