Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
For starters, your $lead fiddling would be best replaced by a simple sprintf or perhaps use Perl's automagical incrementing:
$num = '0000'; for(1..1000) { print ++$num,"\n"; }
will do what you want with much less fuss.

To your main question, in order to discover whether these JPGs actually exist, why not just download them since you want to look at them anyway, and for that you should find LWP::Simple's getstore() handy. If you really don't want to download them, then just use the head() function to see what the server will offer for each filename, and act accordingly.

One more thing, you should really make a habit of using the 3-arg version of open.

Update: Yes of course, silly me!

Update 2: In response to rodion's excellent question, I did a little reading and my interpretation is that at least for HTML 1.1, the HEAD should return exactly what a simple GET returns, minus the message body content. That implies (to the optimist in me at least) that the HEAD should not return if the GET would not. In fact, in section 9.4 (page 53 of RFC 2616), it notes that HEAD is often used for testing link validity. It would seem that for compliant servers at least, using HEAD should work. Corrections or clarifications are welcome!

I'd like to be able to assign to an luser

In reply to Re: Check links.. if they do exist, then print link to file...but how do i check the existance of a link?(validity?) by Albannach
in thread Check links.. if they do exist, then print link to file...but how do i check the existance of a link?(validity?) by dark314

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [erix]: I give up. Actually got some useful stuff to do :)

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (14)
    As of 2018-06-22 14:50 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (124 votes). Check out past polls.