Hi,
I am using the following code block to produce the datastructure shown as output.
open (NEW , "< /text.txt");
while(<NEW>){
@val=split /\t/;
$Tech_fy_reldata{$val[$npo]}{$val[$fy_closed]}[0] = '0';
}
________OUTPUT_______
$VAR5 = 'Data';
$VAR6 = {
'2007' => [
'0'
]
};
$VAR7 = 'DataBase';
$VAR8 = {
'2005' => [
'0'
],
'' => [
'0'
],
'2007' => [
'0'
],
'2004' => [
'0'
],
'2006' => [
'0'
]
};
My requirment is instead of using a predefined HoH (
$Tech_fy_reldata{$val[$npo]}{$val[$fy_closed]}[0] = '0';)
, I need to create the same kind of output for more no of key is more levels of hash dynamicaly.
For ex, instead of
$npo,$fy_closed there may be any variables and more than two or even one.
Values
$npo,$fy_closed are stored in an array.So based upon the no of elements in the array my hash tobe builded.
Basically i am using this structure to group the line in a text file(somthing like group by clause in sql)
Is there any otherway to accomplish this task?
Please help me.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.