?? conelec1.pl
字號:
use CGI;
use CGI ":standard";
use Fcntl qw(:DEFAULT :flock);
sub error {
print start_html();
print "Error - input/output error in conelec1.pl <br/>";
print end_html();
exit(1);
}
my($age, $gender, $vote) = (param("age"), param("gender"), param("vote"));
print header;
# Set $index to the line index of the current vote
$index = $age + $gender;
# Open and lock the survey data file
open(SURVDAT, "+<survdat.dat") or error();
flock(SURVDAT, LOCK_EX) or error();
# Read the survey data file, unlock it, and close it
for ($count = 0; $count <= 7; $count++) {
chomp($file_lines[$count] = <SURVDAT>);
}
# Split the line into its parts, increment the chosen device, and
# put it back together again
@file_votes = split / /, $file_lines[$index];
$file_votes[$vote]++;
$file_lines[$index] = join(" ", @file_votes);
# Rewind the file for writing
seek(SURVDAT, 0, 0) or error();
# Write out the file data and close it (which also unlocks it)
foreach $line (@file_lines) {
print SURVDAT "$line\n";
}
close(SURVDAT);
# Build the web page to thank the survey participant
print start_html("Thankyou");
print "Thank you for participating in our survey <br/> <br/> \n";
print end_html;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -