Given the string Wibble eq wobble myhost.example.com I would like to be able to extract the last element.
My current effort is:
my @parts = split( /\s+/, "Wibble eq wobble myhost.example.com");
my $host = $parts[-1];
print "$host\n";
How do I do this with out the intermediate @parts array?
my ($host) = ($str =~ /(\S+)$/)