Silly and obvious question but can you resolve "cpan.strawberryperl.com" or "www.cpan.org" from the command line with nslookup?
What happens if you go to cpan.strawberryperl.com or www.cpan.org via your browser? You say "assignment" so are you behind a proxy/firewall at school/college? If so take a look at using LWP behind a proxy.
In order of likelihood this looks like either:
a name resolution issue. ie. /etc/hosts or nslookup
you're behind a proxy and need to add the proxy server to your code
or possibly your timing out in which case set $ua->timeout() but don't think that is your problem.