Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: how to read data from a URL

by Tomte (Priest)
on May 15, 2007 at 07:55 UTC ( #615485=note: print w/replies, xml ) Need Help??

in reply to how to read data from a URL

Something like the following should get you going:

use strict; use warnings; use LWP::Simple; my $url = ""; my $content = get($url); $content =~ s/ /%20/g;


An intellectual is someone whose mind watches itself.
-- Albert Camus

Replies are listed 'Best First'.
Re^2: how to read data from a URL
by xhunter (Sexton) on May 15, 2007 at 23:29 UTC
    # An example using WWW::Mechanize and URI::Escape
    use strict;
    use WWW::Mechanize;
    # Create a new mechanize object
    my $mech = WWW::Mechanize->new();
    my $url = '';
    # Associate the mechanize object with a URL
    # Print the content of the URL
    print $mech->content;
    # Load URL::Escape to escape URI's with uri_escape method.
    use URI::Escape;
    my @links = $mech->links;
    foreach my $link (@links) {
        print uri_escape($link->url), "\n";   

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://615485]
Tanktalus looks at new C++ features and thinks they are starting to look a bit perlish.
Tanktalus * new to me anyway :)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-11-24 21:36 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (353 votes). Check out past polls.