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.

Thanks.
Brian
BrianGAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
What problems are you having with the LWP module?
0
khacharnCommented:
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('www.xyz.com/page/page.html);
****************************************
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)
****************************************
open(File,">pagefetched.html);
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..
Nitin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clockwatcherCommented:
Why would you want to print it to a file?

use LWP::Simple;

$page = get('http://www.experts-exchange.com');

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

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




0
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.