#! /usr/bin/perl $check = 0; # 予約文字 @reserves = ( 'sakura' , 'tomoyo' , 'misaki' ); # ユーザ入力 $userinput = "TomoyoChan"; # 予約文字一致チェック foreach $oneword (@reserves) { if( $userinput =~ m/$oneword/i ) { # 一致したモノがあれば print "入力された文字列「$userinput」には、システム予\\約文字「$oneword」が含まれています。\n"; $check++; last; } } # 一致したモノがなければ if( $check == 0 ) { print "入力された文字列「$userinput」には問題ありません。\n"; } exit;