Welcome to the monastery. As
Happy-the-monk was alluding to, the script you have posted should run in less than a second, since you are not actually connecting to anything. Please post a complete example - something that when you run requires 3-4 minutes - so that we can run the exact code you run. This is particularly important, since the default timeout on LWP::UserAgent is 180 seconds, which would put the script at the 3-4 minute range. See
How do I post a question effectively? for more details.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.