我讀過有關Perl CGI,但我不明白open(HAIR,"hair".$q->param('Hair'));
的Perl CGI開放機能的研究知識
#!/usr/bin/perl
use CGI;
$q = new CGI;
if (defined($q->param('Head'))) {
print $q->header(-type => 'image/bmp');
open(HEAD, "head" . $q->param('Head'));
open(HAIR, "hair" . $q->param('Hair'));
open(NOSE, "nose" . $q->param('Nose'));
open(MOUTH, "mouth" . $q->param('Mouth'));
open(EYES, "eyes" . $q->param('Eyes'));
while (read(HEAD, $headb, 1)) {
read(HAIR, $hairb, 1);
read(NOSE, $noseb, 1);
read(MOUTH, $mouthb, 1);
read(EYES, $eyesb, 1);
print(chr(ord($headb) & ord($hairb) & ord($noseb) & ord($mouthb) & ord($eyesb)));
}
}
我只看到開功能像open(FileHandle, filename)
,那麼什麼是.$q->param('Nose')
?
CGI-> param()獲取發送到網頁的表單或查詢變量;例如http://example.com/?head=abc $ q-> param('head')將是'abc'。 – harvey 2014-10-31 06:09:54
'print「hair」。$ q-> param('Hair');'也許?關於'open()'paractices => http://modernperlbooks.com/mt/2010/04/three-arg-open-migrating-to-modern-perl.html – 2014-10-31 06:42:10