Actually you can just do it in a oneliner. $ perl -MLWP::Simple -e'getprint shift' 'http://xxx.xx.xx.xx/dir/index.html'#!/usr/bin/perl -w use strict; use LWP::Simple; getprint 'http://xxx.xx.xx.xx/dir/index.html';
If you need to store the page content in a variable, it's as easy as using get() instead. See the POD for futher info.
Given this, I really think you shouldn't reinvent the wheel using Expect - what you messed up, as you see, was a related to the HTTP protocol, not your Perl code. LWP has been written to handle all the details of the protocol for you - so you're better off using that instead of writing fragile hacks. I'm not flaming, this is honest advice. :) See my signature too..
Makeshifts last the longest.
In reply to Re: Using Expect mod to telnet to port 80 (HTTP)
by Aristotle
in thread Using Expect mod to telnet to port 80 (HTTP)
by ATB
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |