#!/usr/local/bin/perl # # 入力の読み込み # read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split (/&/,$buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # # 変数の読み込み # $source = $FORM{'source'}; $word = $FORM{'word'}; # # 文字の検索と結果の表示 # print "Content-type: text/html\n\n"; print ''; print '検索対象の「'."$word".'」は,

'; @line = split (/\n/, $source); $wcnt = 1; foreach $linestr (@line) { if ($linestr =~ /$word/i) { print "$wcnt".'行目:'."$linestr".'
'; } $wcnt++; } print '
にあります.

'; print '前のページに戻る'; print '';