> -----Original Message-----
> From: Jennifer Pan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 01, 2001 4:45 PM
> To: [EMAIL PROTECTED]
> Subject: save file in an array
> 
> 
> I want to download a page, and want to save it in an array to parse it
> later on,
> I did
> 
> #usr/local/bin/perl
> my @list;
> 
> $URL1= "http://blablabla";;
> $command="/opt/sfw/bin/wget -nv -O @list $URL1";

Perl will interpolate @list here and replace it with "", since @list is
empty.
(Which is just as well, since the shell has no idea what a perl array is.)

> system "$command";
> print @list;
> 
> it didn;t work. But if I say 
> $command="/opt/sfw/bin/wget -nv -O list $URL1";
> 
> it works, but it saved the downloaded file into a file named "list" in
> the current directory.
> 
> How do I save a file to an local variable?

Get your system command to write its output to stdout and capture the output
with backticks:

   $output = `$command`

Or, open the file created by your command and read it.

Also, consider using the LWP::Simple or LWP::UserAgent modules, which let
you make HTTP and other requests directly from Perl.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to