07/11/13 16:29:42
>>54
こんな感じはどうよ。適当に書いたからちゃんと動くかどうか知らんけど。
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use FileHandle;
use File::Spec;
my $cgi = CGI->new;
my $fh = FileHandle->new;
my $html_dir = '/path/to/html/dir';
my $output = $cgi->header( -type => 'text/html' );
my $fn = q{};
if ( $cgi->param('answer1') eq 'Yes' ) {
$fn = 'q2.html';
}
else {
$fn = 'q3.html';
}
$fh->open( File::Spec->catfile( $html_dir, 'q2.html' ) '<');
my $data = do { local $/; <$fh> };
$fh->close;
$output .= $data;
print $output;