#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use LWP::UserAgent; my $url = 'http://wordpress.org/latest'; my $ua = 'LWP::UserAgent'->new; if (my $header = $ua->head($url)) { my ($version) = $header->header('Content-Disposition') =~ /(\d+\.\d+(?:\.\d+)?)/; say $version; } else { die "Can't retrieve the header from '$url'.\n"; }