Perl ( $max, ):
(length $1 > $max) && ($max = length $1) while "a,set,of,random,words" =~ /(\w+)/g;
:
(length $_ > $max) && ($max = length $_) foreach split /,/, "a,set,of,random,words";
:
$max = length((sort { length $b <=> length $a } split /,/, "a,set,of,random,words")[0]);
TMTOWTDI, .
EDIT: !
use List::Util 'reduce';
$max = length reduce { length $a > length $b ? $a : $b } split /,/, "a,set,of,random,words";
... - . , !
2: map():
use List::Util 'max';
$max = max map length, split /,/, "a,set,of,random,words";
, .
3: :
($max) = sort { $b <=> $a } map length, split /,/, "a,set,of,random,words";