-2
use Data::Dumper;
print "enter number of orders";
$count=<STDIN>;
//declaring arrays
my @arr;
my @order;
my @protocol;
my @message_length;
my @logon;
my @value_send;
my @value_receive;
my @seq_number;
my @time;
my @retransmission;
my @account;
my @destination;
my @qty_order;
my @ticker;
my @instruction;
my @order;
my @locate;
my @duration;
my @market;
my @id;
my @timeexecution;
my @userid;
my @checksum;
for ($i=1; $i<=$count; $i++) {
// taking input from user
print "enter the value of tag8";
$protocol[$i]=<STDIN>;
chomp($protocol[$i]);
print "enter the value of tag9";
$message_length[$i]=<STDIN>;
chomp($message_length[$i]);
print "enter the value of tag35";
$logon[$i]=<STDIN>;
chomp($logon[$i]);
print "enter the value of tag49";
$value_send[$i]=<STDIN>;
chomp($value_send[$i]);
print "enter the value of tag56";
$value_recieve[$i]=<STDIN>;
chomp($value_recieve[$i]);
print "enter the value of tag34";
$seq_number[$i]=<STDIN>;
chomp($seq_number[$i]);
print "enter the value of tag52";
$time[$i]=<STDIN>;
chomp($time[$i]);
print "enter the value of tag43";
$retransmission[$i]=<STDIN>;
chomp($retransmission[$i]);
print "enter the value of tag1";
$account[$i]=<STDIN>;
chomp($account[$i]);
print "enter the value of tag100";
$destination[$i]=<STDIN>;
chomp($destination[$i]);
print "enter the value of tag38";
$qty_order[$i]=<STDIN>;
chomp($qty_order[$i]);
print "enter the value of tag55";
$ticker[$i]=<STDIN>;
chomp($ticker[$i]);
print "enter the value of tag21";
$instruction[$i]=<STDIN>;
chomp($instruction[$i]);
print "enter the value of tag54";
$order[$i]=<STDIN>;
chomp($order[$i]);
print "enter the value of tag114";
$locate[$i]=<STDIN>;
chomp($locate[$i]);
print "enter the value of tag59";
$duration[$i]=<STDIN>;
chomp($duration[$i]);
print "enter the value of tag40";
$market[$i]=<STDIN>;
chomp($market[$i]);
print "enter the value of tag11";
$id[$i]=<STDIN>;
chomp($id[$i]);
print "enter the value of tag60";
$timeexecution[$i]=<STDIN>;
chomp($timeexecution[$i]);
print "enter the value of tag553";
$userid[$i]=<STDIN>;
chomp($userid[$i]);
print "enter the value of tag10";
$checksum[$i]=<STDIN>;
chomp($checksum[$i]);
// I need to make hash dynamically for more than 1 iterations
my %userhash1 = (
"8" => $protocol[$i],
"9" => $message_length[$i],
"35" => $logon[$i],
"49" => $value_send[$i],
"56" => $value_recieve[$i],
"34" => $seq_number[$i],
"52" => $time[$i],
"43" => $retransmission[$i],
"1" => $account[$i],
"100" => $destination[$i],
"38" => $qty_order[$i],
"55" => $ticker[$i],
"21" => $instruction[$i],
"54" => $order[$i],
"114" => $locate[$i],
"59" => $duration[$i],
"40" => $market[$i],
"11" => $id[$i],
"60" => $timeexecution[$i],
"553" => $userid[$i],
"10" => $checksum[$i],
);
//using hash of hash
$userhash2{"KEY"}={%userhash1};
// printing the hash
print Dumper(\%userhash2);
}
你应该[编辑]你的问题到a)修复代码格式和b)添加一个实际的问题 - 这应该做什么?你会收到错误消息吗?发生什么事而不是你认为应该发生的事情? –
这个问题似乎是你不知道Perl([perlsyn](http://perldoc.perl.org/perlsyn.html))。这是一个准确的评估? –
我想你想让'userhash'成为一个哈希数组? –