> -----Original Message-----
> From: Thomas Evangelidis [mailto:[email protected]]
> Sent: Thursday, February 19, 2009 09:12
> To: Wagner, David --- Senior Programmer Analyst --- CFS
> Cc: [email protected]
> Subject: Re: calling a program from a perl script and
> redirecting to output to a file
>
> 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.
>
You can do undef @myout;
but it really depends upon what system you are running under and how
they handle the release of memory. This should cutdown, but you could
also use brackets like:
{
my @myout = `program file`;
# now process what is in @myout and either save to
another arry which you want to write eventually or
# write to a file with the necessary data that meets
your criteria
}
after the }, the my @myout would be released
> thanks in advance,
> Thomas
>
> 2009/2/19 Wagner, David --- Senior Programmer Analyst --- CFS <
> [email protected]>
>
> > > -----Original Message-----
> > > From: Thomas Evangelidis [mailto:[email protected]]
> > > Sent: Thursday, February 19, 2009 08:27
> > > To: [email protected]
> > > 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
> > >
> >
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/