This seems to work for me:

$apbs = '/bin/ls';
$output = 'output.txt';
`$apbs > $output`

Does this do what you need?


On Feb 19, 2009, at 10:11 AM, Thomas Evangelidis wrote:

Thank you David. A typical output file comprises ~200 lines. Most of those files are useless and thus the arrays that contain theirs lines will occupy
extra memory. I am running many such scripts concurrently which invoke
similar processes several times so I'm wondering if there is a way to erase
those arrays from memory upon completion of the execution.

thanks in advance,
Thomas

2009/2/19 Wagner, David --- Senior Programmer Analyst --- CFS <
david.wag...@fedex.com>

-----Original Message-----
From: Thomas Evangelidis [mailto:teva...@gmail.com]
Sent: Thursday, February 19, 2009 08:27
To: beginners@perl.org
Subject: calling a program from a perl script and redirecting
to output to a file

Dear Perl programmers,

I want to run a program from a perl script and redirect the
its output to a
file. The programs is called apbs and takes 1 argument, so in
unix shell I
'm simply typing the following:

$apbs input.in >$ output.txt   # '>' doesn't work here
       Unless the output is trully large, I use somehting like:

      my @myout = `$apbs input.in`;
Then I parse what is in the array. I have number of processes that I do
this way.
       If you have any questions and/or problems, please let me know.
       Thanks.

Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight
1.719.484.2097 TEL
1.719.484.2419 FAX
1.408.623.5963 Cell
http://fedex.com/us



When using the system function I get an error. Does anyone know how to
achieve that in perl.

thanks in advance,
Thomas



Sincerely,
James Moser
ja...@endpoint.com

There are 10 kinds of people in the world.
Those who understand binary, and those who do not.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to