http://www.perlmonks.org?node_id=316845


in reply to Getting more out of LWP::Simple

Excellent Tutorial, Dog and Pony. I have seen a number of posts on checking a remote file, so I offer this solution using LWP::Simple, hoping this is the best place to put it.

#!/usr/bin/perl -w use strict; use LWP::Simple; my $url = 'http://www.somesite.com/somefile'; head($url) ? print "Good\n" : print "No file\n"; #or if you don't like/know about ?: if (head($url)) { print "Good\n"; } else { print "No File\n"; }

Update: yes I know this is in the head function in the tutorial, I just want to stress that it can be done to anyfile not just a webpage

"Pain is weakness leaving the body, I find myself in pain everyday" -me