I figured that alright and tried the code with all the spaces but it didn't make any difference. I'm pulling the data from a database that's why the white space is there. That's also how it's being assigned the undef value although I don't know why. Here's the structure of the code that's doing that:
my %ret;
if ( defined( $rv ) and @$rv )
{
map { %{$ret{$$_{name}}->{$$_{project}}={$$_{result}}}
+} @$rv;
}
return %ret;
Update: I finally managed to get this working the way I wanted. Just thought I'd post how I did it in case it's useful to someone else in the future and wanted to say thanks to everyone that took the time to reply to me. Here's the approach I took:
my ($value1, $value2);
foreach (sort keys %hash)
{
foreach (sort keys %{$hash{$random_name}})
{
foreach $k1 (sort keys %{$hash{$random_name}{$fixed_name1}})
{
$value1 = $k1;
}
foreach $k2 (sort keys %{$hash{$random_name}{$fixed_name2}})
{
$value2 = $k2;
}
etc.
}
}
print "$value1\n";
Worked a charm. My full version has some error checking in case one of the values didn't exist. Did this with some
if defined before the
foreach and an
else { after.
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.