ファイル名: w/keys_values_each_delete.cgi

#!/usr/local/bin/perl

#------------------------------------------------------------
$Title = 'A';
$BODY = '<BODY BGCOLOR="#000000" TEXT="#C0C0C0">';
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>$Title</TITLE></HEAD>\n";
print "$BODY\n";
print "<blockquote>\n";
print "<FONT SIZE =5>\n";
#----------------------------------------------------------
%A = ("aaa","bbb","ccc","ddd","eee","fff");
#-----------------------------------------------------
@W = %A;
print "1\@W\n";
print "<BR>\n";
print "@W\n";
print "<BR>\n";
print "<FONT COLOR =FFOOOO SIZE =3>これは、配列なぜか、順番が変わっている。</FONT>\n";
print "<BR>\n";
print "<BR>\n";
#-----------------------------------------------------
@Q = keys(%A);

print "2.\@Q(keys)\n";
print "<BR>\n";
print "@Q\n";
print "<BR>\n";
print "<FONT COLOR =FFOOOO SIZE =3>呼び出すキー全部</FONT>\n";
print "<BR>\n";
print "<BR>\n";
#------------------------------------------------------
@X = values(%A);

print "3.\@X(values)\n";
print "<BR>\n";
print "@X\n";
print "<BR>\n";
print "<FONT COLOR =FFOOOO SIZE =3>呼び出される値、全部</FONT>\n";
print "<BR>\n";
print "<BR>\n";
#---------------------------------------------------------
@S= each(%A);

print "4.\@S(each)\n";
print "<BR>\n";
print "@S\n";
print "<BR>\n";
print "<FONT COLOR =FFOOOO SIZE =3>最初の、キーと値。配列ではなく、変数(\$key,\$value)のリストで、取り出すのが目的?。</FONT>\n";
print "<BR>\n";
print "<BR>\n";
#---------------------------------------------------------
@Z = delete $A{"aaa"};

print "5.\@Z(delete)\n";
print "<BR>\n";
print "KEYにaaaを、指定した場合\n";
print "<BR>\n";
print "@Z\n";
print "<BR>\n";
print "<FONT COLOR =FFOOOO SIZE =3>出力は、deleteされた、値だけ。KEYaaaと、値bbbの組みは、削除された?</FONT>\n";
print "<BR>\n";
print "<BR>\n";
#---------------------------------------------------------
print "<FONT COLOR =FFFOOO SIZE =3>eachと、deleteは、説明不足。ハッキリ解ってない。</FONT>\n";

#---------------------------------------------------------
print "</FONT>\n";
print "</blockquote>\n";
print "</BODY>\n";
print "</HTML>\n";
exit;