while () { chomp; last if $_ eq ''; push @files, $_; } printf "You entered %d files: { %s }\n", scalar @files, join(' ', @files);