Advertisement
hakonhagland

CGI3

Jul 17th, 2015
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use CGI qw( -utf8 );
  2. use CGI::Carp qw(fatalsToBrowser);
  3. use utf8;
  4.  
  5. $cgi=CGI->new();
  6.  
  7. print $cgi->header();
  8.  
  9. $page        = $cgi->param('page');
  10. $root_dir = "/home2/godspla1/public_html/romanian";
  11.  
  12. $root_dir =~ s|/$||; #get rid of trailing slash
  13.  
  14. open (RESULTS, "$root_dir/$page")
  15.   or die "Can't open results page ($root_dir/$page): $!";
  16. binmode STDOUT, ":utf8";
  17. open (my $fh, ">:encoding(utf8)", "$root_dir/temp.txt" ) or die "Can't open file ($root_dir/temp.txt): $!";
  18. while ( <RESULTS> ) {
  19.      print \n";
  20.      print $fh \n";
  21. }
  22. close $fh;
  23. close RESULTS;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement