#/usr/bin/perl use Encode; use utf8; use List::Util qw/max min/; binmode STDIN, ':encoding(utf8)'; $i = 1; $count = 0; $maxcount = 0; while() { my $inputtext = $_; my @text = split(/w/, $inputtext); foreach my $tepart(@text) { $count[$i] = length($tepart); if ($count[$i] >= $maxcount) { $maxcount = $count[$i]; } $i++; } foreach my $tepart2(@text) { $telength = length($tepart2); if ($telength == $maxcount) { print "$tepart2\n"; } } }