# Process the form if there is a file name entered if (my $file = param('filename')) { my %stats; my $tmpfile=tmpFileName($file); my $mimetype = uploadInfo($file)->{'Content-Type'} || ''; print hr(), h2($file), h3($tmpfile), h4("MIME Type:",em($mimetype)); my($lines,$words,$characters,@words) = (0,0,0,0); while (<$file>) { $lines++; $words += @words=split(/\s+/); $characters += length($_); } close $file; grep($stats{$_}++,param('count')); if (%stats) { print strong("Lines: "),$lines,br if $stats{'count lines'}; print strong("Words: "),$words,br if $stats{'count words'}; print strong("Characters: "),$characters,br if $stats{'count characters'}; } else { print strong("No statistics selected."); } } #### $filename = $query->param('uploaded_file'); @stats=stat $filename; $size_of_file=$stats[7];