use strict;
use Tie::IxHash;
tie( my %csv, 'Tie::IxHash',
'one' => undef,
'two' => undef,
'three' => undef,
'four' => undef,
'five' => undef,
);
my %login;
{
my %dummy = %csv;
$dummy{one} = "11";
$dummy{two} = "12";
$dummy{three} = "13";
$dummy{four} = "14";
$dummy{five} = "15";
$login{1} = \%dummy;
}
{
my %dummy = %csv;
$dummy{one} = "11";
$dummy{two} = "12";
$dummy{three} = "23";
$dummy{four} = "14";
$dummy{five} = "25";
$login{2} = \%dummy;
}
{
my %dummy = %csv;
$dummy{one} = "31";
$dummy{two} = "12";
$dummy{three} = "23";
$dummy{four} = "34";
$dummy{five} = "25";
$login{2} = \%dummy;
while (my ($k,$v) = each %login) {
print "NEW\n";
while ( my ($k, $v) = each %{dummy} ) { print $k." =". $v ."\n";
+ }
}
}
I want the output to be:
NEW
one =11
five =12
three =13
two =13
four =14
five =15
NEW
one =31
five =25
three =23
two =12
four =34
five =25
Problem is that i want to loop login and if the key of login matches with one before it should be a hash union and when it doesn't matches just print the hash it contains.
If you need some more info pm me... I'm going to try to find the solution too :p But have been trying many options and I'm a bit stuck :(
--
My opinions may have changed,
but not the fact that I am right
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.