1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env perl use strict; use warnings; sub last_word{ length((split /\s/,$_[0])[-1]) } printf "%d\n",last_word('The Weekly Challenge'); printf "%d\n",last_word(' Hello World '); printf "%d\n",last_word('Let\'s begin the fun');