### Code to print page # I am reading from another file and parsing what I want betweeen these tags if ($hold=~/<\?--printpg-->(.*?)<\/\?--printpg-->/gis) { my $page_to_print=$1; #generate freakyness here. my $freaky_number=int(rand(9999)) + 1; my $temp_file = "${curr_dir}".$freaky_number.".html"; # At this point I have the html page just the way I want, next is to display it. open(FILE_IN, ">$temp_file") || warn "Can't open output file $temp_file: $!"; print FILE_IN "
"; print FILE_IN "$page_to_print"; close FILE_IN; # Here I am extracting just the file name out of the whole path if($temp_file =~/(.*?)\\([^\\]+)$/){ $file_hold=$2;} # Here I can send this page to the browser and it will open the printer window automatically, it's done! print "