use warnings; use strict; my $max = 0; while (<>) { my $len = length; $max = $len if $len > $max; } print "$max\n";