Perl5 Hash数组(数组元素是Hans结构)
Perl5 Hash数组(数组元素是Hans结构)----定义与使用
-----问题引出----
?
数组中的元素是否可以是Hash表?
?
回答是肯定的。
?
如何初始化一个Hash数组?
?
a) 直接赋值
引用网上一段代码:
my @wenjus=({name=>"钢笔",price=>8.06, count=>50},{name=>"2B铅笔",price=>2.10,count=>300},{name=>"胶水",price=>5.80,count=>60},{name=>"剪刀",price=>12.20,count=>28});my $num = 0;foreach $wenju (@wenjus) {$num++;print "品名:".$wenju->{"name"}."\n";print "价格:".$wenju->{"price"}."\n";print "数量:".$wenju->{"count"}."\n";}
?
这样赋值与定义是可以成功输出的--输出结果如下:
品名:钢笔
价格:8.06
数量:50
品名:2B铅笔
价格:2.1
数量:300
品名:胶水
价格:5.8
数量:60
品名:剪刀
价格:12.2
数量:28
?
b) 读取数据库或者读取配置文件
?
1、配置文件
?
#resattributeid|attributecolumnname|attributecnname|datatype|ifchange|sourceexpression|dispindex|datalength1|test1|测试1|string|1|select id,name from rms_test where stateflag=0|1|1282|test2|测试2|string|1||2|1283|test3|测试3|string|1||3|1284|test4|测试4|string|1||4|1285|test5|测试5|string|1|select id,name from rms_test where stateflag=0|5|1286|test6|测试6|string|1||6|1287|test7|测试7|string|1||7|1288|test8|测试8|string|1||8|1289|test9|测试9|string|1|select id,name from rms_test where stateflag=0|9|12810|test10|测试10|string|1||10|128
?
2、源代码
?
#!/usr/bin/perl###################################################################################### 支持200个Hash的数组定义方法,## 编写:高增光## 日期:2011.09.16北京 ## 功能:测试脚本## 脚本说明:my $attributes="/u1/tmn/wlzy/data_import/cfg/attributes.dat";open(RFILE,"<$attributes") || die "Failed to open $attributes for parsing!!\n";my @attributeObj_list=();my $num=0;while(defined($line=<RFILE>)){chomp($line);#忽略空行if(length($line) eq 0){next;}if ($line =~ /#/)#忽略注释行 {next;} @attributeObj=split(/\|/,$line); #foreach $val (@attributeObj) #{#print "数组输出:".$val."\n";#} my %attributeObj_hash = (); $attributeObj_hash{"resattributeid"} = $attributeObj[0]; $attributeObj_hash{"attributecolumnname"} = $attributeObj[1]; $attributeObj_hash{"attributecnname"} = $attributeObj[2]; $attributeObj_hash{"datatype"} = $attributeObj[3]; $attributeObj_hash{"ifchange"} = $attributeObj[4]; $attributeObj_hash{"sourceexpression"} = $attributeObj[5]; $attributeObj_hash{"dispindex"} = $attributeObj[6]; $attributeObj_hash{"datalength"} = $attributeObj[7]; if($num == 0){ my $hash_obj_000 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_000 );}elsif($num == 1){ my $hash_obj_001 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_001 );}elsif($num == 2){ my $hash_obj_002 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_002 );}elsif($num == 3){ my $hash_obj_003 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_003 );}elsif($num == 4){ my $hash_obj_004 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_004 );}elsif($num == 5){ my $hash_obj_005 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_005 );}elsif($num == 6){ my $hash_obj_006 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_006 );}elsif($num == 7){ my $hash_obj_007 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_007 );}elsif($num == 8){ my $hash_obj_008 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_008 );}elsif($num == 9){ my $hash_obj_009 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_009 );}elsif($num == 10){ my $hash_obj_010 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_010 );}elsif($num == 11){ my $hash_obj_011 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_011 );}elsif($num == 12){ my $hash_obj_012 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_012 );}elsif($num == 13){ my $hash_obj_013 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_013 );}elsif($num == 14){ my $hash_obj_014 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_014 );}elsif($num == 15){ my $hash_obj_015 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_015 );}elsif($num == 16){ my $hash_obj_016 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_016 );}elsif($num == 17){ my $hash_obj_017 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_017 );}elsif($num == 18){ my $hash_obj_018 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_018 );}elsif($num == 19){ my $hash_obj_019 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_019 );}elsif($num == 20){ my $hash_obj_020 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_020 );}elsif($num == 21){ my $hash_obj_021 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_021 );}elsif($num == 22){ my $hash_obj_022 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_022 );}elsif($num == 23){ my $hash_obj_023 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_023 );}elsif($num == 24){ my $hash_obj_024 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_024 );}elsif($num == 25){ my $hash_obj_025 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_025 );}elsif($num == 26){ my $hash_obj_026 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_026 );}elsif($num == 27){ my $hash_obj_027 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_027 );}elsif($num == 28){ my $hash_obj_028 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_028 );}elsif($num == 29){ my $hash_obj_029 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_029 );}elsif($num == 30){ my $hash_obj_030 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_030 );}elsif($num == 31){ my $hash_obj_031 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_031 );}elsif($num == 32){ my $hash_obj_032 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_032 );}elsif($num == 33){ my $hash_obj_033 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_033 );}elsif($num == 34){ my $hash_obj_034 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_034 );}elsif($num == 35){ my $hash_obj_035 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_035 );}elsif($num == 36){ my $hash_obj_036 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_036 );}elsif($num == 37){ my $hash_obj_037 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_037 );}elsif($num == 38){ my $hash_obj_038 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_038 );}elsif($num == 39){ my $hash_obj_039 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_039 );}elsif($num == 40){ my $hash_obj_040 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_040 );}elsif($num == 41){ my $hash_obj_041 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_041 );}elsif($num == 42){ my $hash_obj_042 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_042 );}elsif($num == 43){ my $hash_obj_043 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_043 );}elsif($num == 44){ my $hash_obj_044 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_044 );}elsif($num == 45){ my $hash_obj_045 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_045 );}elsif($num == 46){ my $hash_obj_046 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_046 );}elsif($num == 47){ my $hash_obj_047 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_047 );}elsif($num == 48){ my $hash_obj_048 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_048 );}elsif($num == 49){ my $hash_obj_049 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_049 );}elsif($num == 50){ my $hash_obj_050 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_050 );}elsif($num == 51){ my $hash_obj_051 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_051 );}elsif($num == 52){ my $hash_obj_052 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_052 );}elsif($num == 53){ my $hash_obj_053 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_053 );}elsif($num == 54){ my $hash_obj_054 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_054 );}elsif($num == 55){ my $hash_obj_055 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_055 );}elsif($num == 56){ my $hash_obj_056 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_056 );}elsif($num == 57){ my $hash_obj_057 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_057 );}elsif($num == 58){ my $hash_obj_058 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_058 );}elsif($num == 59){ my $hash_obj_059 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_059 );}elsif($num == 60){ my $hash_obj_060 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_060 );}elsif($num == 61){ my $hash_obj_061 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_061 );}elsif($num == 62){ my $hash_obj_062 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_062 );}elsif($num == 63){ my $hash_obj_063 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_063 );}elsif($num == 64){ my $hash_obj_064 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_064 );}elsif($num == 65){ my $hash_obj_065 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_065 );}elsif($num == 66){ my $hash_obj_066 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_066 );}elsif($num == 67){ my $hash_obj_067 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_067 );}elsif($num == 68){ my $hash_obj_068 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_068 );}elsif($num == 69){ my $hash_obj_069 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_069 );}elsif($num == 70){ my $hash_obj_070 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_070 );}elsif($num == 71){ my $hash_obj_071 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_071 );}elsif($num == 72){ my $hash_obj_072 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_072 );}elsif($num == 73){ my $hash_obj_073 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_073 );}elsif($num == 74){ my $hash_obj_074 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_074 );}elsif($num == 75){ my $hash_obj_075 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_075 );}elsif($num == 76){ my $hash_obj_076 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_076 );}elsif($num == 77){ my $hash_obj_077 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_077 );}elsif($num == 78){ my $hash_obj_078 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_078 );}elsif($num == 79){ my $hash_obj_079 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_079 );}elsif($num == 80){ my $hash_obj_080 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_080 );}elsif($num == 81){ my $hash_obj_081 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_081 );}elsif($num == 82){ my $hash_obj_082 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_082 );}elsif($num == 83){ my $hash_obj_083 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_083 );}elsif($num == 84){ my $hash_obj_084 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_084 );}elsif($num == 85){ my $hash_obj_085 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_085 );}elsif($num == 86){ my $hash_obj_086 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_086 );}elsif($num == 87){ my $hash_obj_087 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_087 );}elsif($num == 88){ my $hash_obj_088 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_088 );}elsif($num == 89){ my $hash_obj_089 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_089 );}elsif($num == 90){ my $hash_obj_090 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_090 );}elsif($num == 91){ my $hash_obj_091 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_091 );}elsif($num == 92){ my $hash_obj_092 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_092 );}elsif($num == 93){ my $hash_obj_093 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_093 );}elsif($num == 94){ my $hash_obj_094 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_094 );}elsif($num == 95){ my $hash_obj_095 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_095 );}elsif($num == 96){ my $hash_obj_096 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_096 );}elsif($num == 97){ my $hash_obj_097 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_097 );}elsif($num == 98){ my $hash_obj_098 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_098 );}elsif($num == 99){ my $hash_obj_099 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_099 );}elsif($num == 100){ my $hash_obj_100 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_100 );}elsif($num == 101){ my $hash_obj_101 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_101 );}elsif($num == 102){ my $hash_obj_102 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_102 );}elsif($num == 103){ my $hash_obj_103 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_103 );}elsif($num == 104){ my $hash_obj_104 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_104 );}elsif($num == 105){ my $hash_obj_105 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_105 );}elsif($num == 106){ my $hash_obj_106 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_106 );}elsif($num == 107){ my $hash_obj_107 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_107 );}elsif($num == 108){ my $hash_obj_108 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_108 );}elsif($num == 109){ my $hash_obj_109 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_109 );}elsif($num == 110){ my $hash_obj_110 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_110 );}elsif($num == 111){ my $hash_obj_111 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_111 );}elsif($num == 112){ my $hash_obj_112 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_112 );}elsif($num == 113){ my $hash_obj_113 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_113 );}elsif($num == 114){ my $hash_obj_114 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_114 );}elsif($num == 115){ my $hash_obj_115 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_115 );}elsif($num == 116){ my $hash_obj_116 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_116 );}elsif($num == 117){ my $hash_obj_117 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_117 );}elsif($num == 118){ my $hash_obj_118 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_118 );}elsif($num == 119){ my $hash_obj_119 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_119 );}elsif($num == 120){ my $hash_obj_120 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_120 );}elsif($num == 121){ my $hash_obj_121 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_121 );}elsif($num == 122){ my $hash_obj_122 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_122 );}elsif($num == 123){ my $hash_obj_123 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_123 );}elsif($num == 124){ my $hash_obj_124 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_124 );}elsif($num == 125){ my $hash_obj_125 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_125 );}elsif($num == 126){ my $hash_obj_126 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_126 );}elsif($num == 127){ my $hash_obj_127 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_127 );}elsif($num == 128){ my $hash_obj_128 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_128 );}elsif($num == 129){ my $hash_obj_129 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_129 );}elsif($num == 130){ my $hash_obj_130 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_130 );}elsif($num == 131){ my $hash_obj_131 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_131 );}elsif($num == 132){ my $hash_obj_132 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_132 );}elsif($num == 133){ my $hash_obj_133 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_133 );}elsif($num == 134){ my $hash_obj_134 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_134 );}elsif($num == 135){ my $hash_obj_135 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_135 );}elsif($num == 136){ my $hash_obj_136 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_136 );}elsif($num == 137){ my $hash_obj_137 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_137 );}elsif($num == 138){ my $hash_obj_138 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_138 );}elsif($num == 139){ my $hash_obj_139 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_139 );}elsif($num == 140){ my $hash_obj_140 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_140 );}elsif($num == 141){ my $hash_obj_141 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_141 );}elsif($num == 142){ my $hash_obj_142 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_142 );}elsif($num == 143){ my $hash_obj_143 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_143 );}elsif($num == 144){ my $hash_obj_144 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_144 );}elsif($num == 145){ my $hash_obj_145 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_145 );}elsif($num == 146){ my $hash_obj_146 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_146 );}elsif($num == 147){ my $hash_obj_147 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_147 );}elsif($num == 148){ my $hash_obj_148 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_148 );}elsif($num == 149){ my $hash_obj_149 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_149 );}elsif($num == 150){ my $hash_obj_150 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_150 );}elsif($num == 151){ my $hash_obj_151 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_151 );}elsif($num == 152){ my $hash_obj_152 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_152 );}elsif($num == 153){ my $hash_obj_153 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_153 );}elsif($num == 154){ my $hash_obj_154 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_154 );}elsif($num == 155){ my $hash_obj_155 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_155 );}elsif($num == 156){ my $hash_obj_156 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_156 );}elsif($num == 157){ my $hash_obj_157 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_157 );}elsif($num == 158){ my $hash_obj_158 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_158 );}elsif($num == 159){ my $hash_obj_159 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_159 );}elsif($num == 160){ my $hash_obj_160 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_160 );}elsif($num == 161){ my $hash_obj_161 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_161 );}elsif($num == 162){ my $hash_obj_162 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_162 );}elsif($num == 163){ my $hash_obj_163 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_163 );}elsif($num == 164){ my $hash_obj_164 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_164 );}elsif($num == 165){ my $hash_obj_165 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_165 );}elsif($num == 166){ my $hash_obj_166 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_166 );}elsif($num == 167){ my $hash_obj_167 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_167 );}elsif($num == 168){ my $hash_obj_168 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_168 );}elsif($num == 169){ my $hash_obj_169 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_169 );}elsif($num == 170){ my $hash_obj_170 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_170 );}elsif($num == 171){ my $hash_obj_171 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_171 );}elsif($num == 172){ my $hash_obj_172 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_172 );}elsif($num == 173){ my $hash_obj_173 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_173 );}elsif($num == 174){ my $hash_obj_174 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_174 );}elsif($num == 175){ my $hash_obj_175 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_175 );}elsif($num == 176){ my $hash_obj_176 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_176 );}elsif($num == 177){ my $hash_obj_177 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_177 );}elsif($num == 178){ my $hash_obj_178 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_178 );}elsif($num == 179){ my $hash_obj_179 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_179 );}elsif($num == 180){ my $hash_obj_180 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_180 );}elsif($num == 181){ my $hash_obj_181 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_181 );}elsif($num == 182){ my $hash_obj_182 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_182 );}elsif($num == 183){ my $hash_obj_183 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_183 );}elsif($num == 184){ my $hash_obj_184 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_184 );}elsif($num == 185){ my $hash_obj_185 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_185 );}elsif($num == 186){ my $hash_obj_186 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_186 );}elsif($num == 187){ my $hash_obj_187 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_187 );}elsif($num == 188){ my $hash_obj_188 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_188 );}elsif($num == 189){ my $hash_obj_189 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_189 );}elsif($num == 190){ my $hash_obj_190 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_190 );}elsif($num == 191){ my $hash_obj_191 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_191 );}elsif($num == 192){ my $hash_obj_192 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_192 );}elsif($num == 193){ my $hash_obj_193 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_193 );}elsif($num == 194){ my $hash_obj_194 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_194 );}elsif($num == 195){ my $hash_obj_195 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_195 );}elsif($num == 196){ my $hash_obj_196 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_196 );}elsif($num == 197){ my $hash_obj_197 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_197 );}elsif($num == 198){ my $hash_obj_198 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_198 );}elsif($num == 199){ my $hash_obj_199 = \%attributeObj_hash;push(@attributeObj_list,$hash_obj_199 );}$num++;}close(RFILE);##输出my $list_size = @attributeObj_list;print "数组大小$list_size\n";for ($i=0; $i < $list_size; $i++){print "《OUT-2》第$i个元素->resattributeid:".$attributeObj_list[$i]{"resattributeid"}."\n";print "《OUT-2》第$i个元素->attributecolumnname:".$attributeObj_list[$i]{"attributecolumnname"}."\n";print "《OUT-2》第$i个元素->attributecnname:".$attributeObj_list[$i]{"attributecnname"}."\n";print "《OUT-2》第$i个元素->datatype:".$attributeObj_list[$i]{"datatype"}."\n";print "《OUT-2》第$i个元素->sourceexpression:".$attributeObj_list[$i]{"ifchange"}."\n";print "《OUT-2》第$i个元素->sourceexpression:".$attributeObj_list[$i]{"sourceexpression"}."\n";print "《OUT-2》第$i个元素->dispindex:".$attributeObj_list[$i]{"dispindex"}."\n";print "《OUT-2》第$i个元素->datalength:".$attributeObj_list[$i]{"datalength"}."\n";}
?
3、执行结果
数组大小10《OUT-2》第0个元素->resattributeid:1《OUT-2》第0个元素->attributecolumnname:test1《OUT-2》第0个元素->attributecnname:测试1《OUT-2》第0个元素->datatype:string《OUT-2》第0个元素->sourceexpression:1《OUT-2》第0个元素->sourceexpression:select id,name from rms_test where stateflag=0《OUT-2》第0个元素->dispindex:1《OUT-2》第0个元素->datalength:128《OUT-2》第1个元素->resattributeid:2《OUT-2》第1个元素->attributecolumnname:test2《OUT-2》第1个元素->attributecnname:测试2《OUT-2》第1个元素->datatype:string《OUT-2》第1个元素->sourceexpression:1《OUT-2》第1个元素->sourceexpression:《OUT-2》第1个元素->dispindex:2《OUT-2》第1个元素->datalength:128《OUT-2》第2个元素->resattributeid:3《OUT-2》第2个元素->attributecolumnname:test3《OUT-2》第2个元素->attributecnname:测试3《OUT-2》第2个元素->datatype:string《OUT-2》第2个元素->sourceexpression:1《OUT-2》第2个元素->sourceexpression:《OUT-2》第2个元素->dispindex:3《OUT-2》第2个元素->datalength:128《OUT-2》第3个元素->resattributeid:4《OUT-2》第3个元素->attributecolumnname:test4《OUT-2》第3个元素->attributecnname:测试4《OUT-2》第3个元素->datatype:string《OUT-2》第3个元素->sourceexpression:1《OUT-2》第3个元素->sourceexpression:《OUT-2》第3个元素->dispindex:4《OUT-2》第3个元素->datalength:128《OUT-2》第4个元素->resattributeid:5《OUT-2》第4个元素->attributecolumnname:test5《OUT-2》第4个元素->attributecnname:测试5《OUT-2》第4个元素->datatype:string《OUT-2》第4个元素->sourceexpression:1《OUT-2》第4个元素->sourceexpression:select id,name from rms_test where stateflag=0《OUT-2》第4个元素->dispindex:5《OUT-2》第4个元素->datalength:128《OUT-2》第5个元素->resattributeid:6《OUT-2》第5个元素->attributecolumnname:test6《OUT-2》第5个元素->attributecnname:测试6《OUT-2》第5个元素->datatype:string《OUT-2》第5个元素->sourceexpression:1《OUT-2》第5个元素->sourceexpression:《OUT-2》第5个元素->dispindex:6《OUT-2》第5个元素->datalength:128《OUT-2》第6个元素->resattributeid:7《OUT-2》第6个元素->attributecolumnname:test7《OUT-2》第6个元素->attributecnname:测试7《OUT-2》第6个元素->datatype:string《OUT-2》第6个元素->sourceexpression:1《OUT-2》第6个元素->sourceexpression:《OUT-2》第6个元素->dispindex:7《OUT-2》第6个元素->datalength:128《OUT-2》第7个元素->resattributeid:8《OUT-2》第7个元素->attributecolumnname:test8《OUT-2》第7个元素->attributecnname:测试8《OUT-2》第7个元素->datatype:string《OUT-2》第7个元素->sourceexpression:1《OUT-2》第7个元素->sourceexpression:《OUT-2》第7个元素->dispindex:8《OUT-2》第7个元素->datalength:128《OUT-2》第8个元素->resattributeid:9《OUT-2》第8个元素->attributecolumnname:test9《OUT-2》第8个元素->attributecnname:测试9《OUT-2》第8个元素->datatype:string《OUT-2》第8个元素->sourceexpression:1《OUT-2》第8个元素->sourceexpression:select id,name from rms_test where stateflag=0《OUT-2》第8个元素->dispindex:9《OUT-2》第8个元素->datalength:128《OUT-2》第9个元素->resattributeid:10《OUT-2》第9个元素->attributecolumnname:test10《OUT-2》第9个元素->attributecnname:测试10《OUT-2》第9个元素->datatype:string《OUT-2》第9个元素->sourceexpression:1《OUT-2》第9个元素->sourceexpression:《OUT-2》第9个元素->dispindex:10《OUT-2》第9个元素->datalength:128
?