# minimum sentence size, to elimnate fluff $min_size=10; # grab and print first 4 sentences only (ending with '.') $article="'Sentence 1. This is sent. 2. This is sentence 3. What? The cost is $1.23, on sale. What do you think? This is the last s\ entence."; ($intro)=($article=~/((?:[^\.]{$min_size,}\.){4})/si); print "$intro\n"; #### im the kink. but you are not the king. we are the kings. yes we are the kings. #### $x = 0; $s = "HOLY BIBLE"; $s =~ s/(\w)/{$x+=($o=ord($1));print"$1 - $o\n";''}/eg; print "Total: $x\n"; #### H - 72 O - 79 L - 76 Y - 89 B - 66 I - 73 B - 66 L - 76 E - 69 Total: 666 #### #!/usr/local/bin/perl use strict; use Time::HiRes qw( time ); use CGI; ################### MAIN ###################### { my $time_start = time; my $cgi = new CGI; print $cgi->header(); print $cgi->start_html(); open(REPORT, ">./report.out"); my $file = $cgi->upload("upload_file"); if (!$file && $cgi->cgi_error) { print $cgi->header(-status=>$cgi->cgi_error); exit 0; } elsif ($file) { use Data::Dumper; my $upload_info = $cgi->uploadInfo($file); print Dumper($upload_info); if (!fork()) { # do this stuff in child process... # get rid of STDOUT so that CGI won't # have to hold on to this (child) process until # it's done. open(STDOUT, ">/dev/null"); my ($local_file) = ($file =~ m|[\\/]+([^\\/]+)$|); open (OUTFILE,">./$local_file"); my ($buffer, $bytesread); while (<$file>) { print OUTFILE $_; } close (OUTFILE); my $time_finish = time; my $child_time = $time_finish - $time_start; print REPORT "Child time: $child_time\n"; # note: this will also flush the buffer, # which may any lines printed to this handle # before the fork() to duplicate! close (REPORT); exit; } print "File '$file' uploaded successfully!

Saved in '$file'. "; } print $cgi->start_multipart_form(); print $cgi->filefield(-name=>'upload_file', -default=>'starting value', -size=>50, -maxlength=>80); print $cgi->submit(-value => 'Submit!'); print $cgi->end_form; my $time_finish = time; my $time_parent = $time_finish - $time_start; print REPORT "Time Start: $time_start\n"; print REPORT "Parent time: $time_parent\n"; # I may end up closing this before even the child process # has finished writing to it? close REPORT; exit; }