#!/usr/bin/perl open $fb, "myfilename.txt"; while ($line=<$fb>) { chomp($line); if ($.=<>){ print length "$line"; } }