Parsing a remote file

I am trying to open a file on a website.  Step through the lines and parse out the information.  What I am having trouble with is opening the remote file.  Specifically how do I read a line.  I know that there is a way to do this.   I have been pointed in the direction of the LWP module, but I am still having problems.

Who is Participating?
khacharnConnect With a Mentor Commented:
hi brian
the solution to your problem is ~

1) use the Lwp::Simple module to get the file(on the we-site) to your machine.
the  script will be something like this
use Lwp::Simple;
$pagefetched = get(';
Now you have the html page you wanted in the String $pagefetched..

2) You can now print this String to a file(thats what i did)
print File $pagefetched;

3) Now you can parse the file(pagefetched.html) to filter the information you want..using the regular expressions
while ($linebyline = <File>)
#here you can process or parse the file line by lien to filterout the infomation you want..

Hope this help
Do ask me anyting on this..
What problems are you having with the LWP module?
Why would you want to print it to a file?

use LWP::Simple;

$page = get('');

@lines = split('\n',$page);

foreach $line (@lines) {
  print "$line\n";

BrianGAuthor Commented:
Both answers are good.  A don't really need to print the lines to a file though, but that might actually be useful for later.  Thanks for your answers and comments.
All Courses

From novice to tech pro — start learning today.