in reply to sprintf number to string
if ($count =~ /\n$/) {chomp($c);} [download]
if ($c =~ /\n$/) {chomp($c);} [download]
The way you have it now, $c will still have the newline at the end.