determine web server type with HEAD

this is probably a stupid question but here goes:

i know how to do this:


200 OK
Cache-Control: private
Connection: Close
Date: Wed, 26 Feb 2003 01:51:29 GMT
Server: SErver Type here/2.0
Content-Length: 2824
Content-Type: text/html
Client-Date: Wed, 26 Feb 2003 01:51:24 GMT
Client-Response-Num: 1
Set-Cookie: PREF=ID=7804376706b65122:TM=1046224289:LM=1046224289:S=bjrD1brYqRTv
Y7h; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/;

but i want to do this in my program and get the same result:

    use LWP:Simple;

    (@stuff) = head($url);

i end up with a very empty array...iam obviously doing something wrong, and i cant find any good documentation on the HEAD method.

any help would be great.....thanx in adv
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Code below works on my computer. Try to reinstall LWP if it don't work on yours.

use LWP::Simple;
my ($content_type, $document_length, $modified_time, $expires, $server) = head("");
print "Server is $server\n";

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
As it says in the LWP::Simple doco


Get document headers. Returns the following 5 values if successful: ($content_type, $document_length, $modified_time, $expires, $server)
Returns an empty list if it fails. In scalar context returns TRUE if successful

You have an empty list, so the head has failed.

real1971Author Commented:
thanx much for the help.......

i was trying to do the head($url) without the "http://"....that was the fix..thanx
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.