Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (10)
    As of 2014-08-22 12:49 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (156 votes), past polls