大家好,小弟的程式码是这样
先开档读档
while (<FILEIN>){
if ($_ =~ /name (\S+) /)
{
$name=$1;
push @name_array, $name;
}
if ($_ =~ /spec (\S+) (\S+) (\S+)/)
{
push @spec_array, $1, $2, $3;
}
if ($_ =~ /spec (\S+)/)
{
push @spec_array, $1;
}
}
close (FILEIN);
for ($i=0;$i<=$#name_array;$i++){
print "name : @all_name[$i]\n";
for ($j=0;$j<=$#spec_array;$j++)
{
print "spec : @spec_array[$j]\n";
}}