厳密なCGIは難しいのでフレームワークを覚えましょう 1 2 3 use Mojolicious::Lite; get '/' => {text => 'Hello World!'}; app->start; 1 2 3 4 5 6 7 #!/usr/bin/env perl use strict; use warnings; if ($ENV{'REQUEST_METHOD'} eq 'GET' and $ENV{'PATH_INFO'} eq '/' or $ENV{'PATH_INFO'} eq '') { print "Content-Type: text/plain\n\n"; print 'Hello World!'; } 1 2 3 4 5 6 7 for my $key (keys %ENV) { print "$key = $ENV{$key}\n"; } # または while (my ($key, $value) = each %ENV) { print "$key = $value\n"; } 1 2 3 4 #!/usr/bin/env perl use utf8; use 5.012; say 'Hello, world!';