As mentioned above, LWP::Simple
will do what you need. But here are a few more tips:
- It's actually spelt 'Perl' not 'PERL'. It may seem pedantic, but people in the Perl community can get a bit irritated if you get this wrong.
- In general, Perl prefers to have less functionality in the 'core', and more in loadable modules, as opposed to PHP, which packs all it's functionality into the core. So for example, in PHP you don't have to do anything special to get a remote URL other than call the function, but in Perl you have a few modules to choose from, one being LWP::Simple. There are pros and cons to both approaches, but it can take a while to get used to this in Perl if you've come from PHP. A good place to find the modules, along with their documentation is search.cpan.org (CPAN is like PEAR in PHP).
- If you have content that you need to URI encode, try URI::Escape (another example of where Perl puts functionality into a module rather than has it in the core as PHP does).
- There are a few places to find Perl's documentation, but one is http://perldoc.perl.org/
Also note that posts on PerlMonks use HTML, so you need to add in linebreaks, etc. It also supports the <code> tags, which make formatting your code much easier. If you wrap your code above in these tags, you'll see what I mean.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.