Thanks to graff's response to this node, I have the following subs. My problem is that, after building a HoHoL (%anchors), I can't print to the filehandles contained in the outermost hash key.
Here's what I get:
Can't use string ("*main::INCUNIX") as a symbol ref while "strict refs +" in use at ./nbu-daily-3.pl line 502, <BPDBJOBS> line 2044.
I use filehandles contained in variables elsewhere in the code, only in the successful instance, I don't push them into a hash. It seems that that shouldn't matter; I'm still writing to a filehandle contained in a variable.

Any thoughts?

# for the sake of brevity, I'll include just the relavent code # here's how I open the files to begin with. my @incHandles = (*INCNT, *INCMAIL, *INCUNIX); my $filepath = "/opt/apache/htdocs/nbu/reports"; open $incHandles[0], ">$filepath/inc.nt" or die "cannot open $filep +ath/inc.nt for writing: $!\n"; open $incHandles[1], ">$filepath/inc.mail" or die "cannot open $filep +ath/inc.mail for writing: $!\n"; open $incHandles[2], ">$filepath/inc.unix" or die "cannot open $filep +ath/inc.unix for writing: $!\n"; # then, as I iterate through a couple of hashes, # amongst other things, I call the following two subs ################################################################## sub printTableRow { my ( $outHandle, $status, $class, $incFlag ) = @_; # Hash of colors my %colors = ( active => "#005154", failed => "#ff0000", queued => "#622188", partial => "#ffb90f", success => "#00ff00" ); # Hash of titles my %titles = ( active => "Active Jobs", failed => "Failed Jobs", queued => "Queued Jobs", partial => "Partially Successful Jobs", success => "Successful Jobs" ); $incString = "<a href=\"\#$class\.$titles{$status}\"><font color=\"$co +lors{$status}\">$class</a></font><br>"; my $incHandle; if ( $incFlag eq "N" ) { $incHandle = *INCnt; } if ( $incFlag eq "M" ) { $incHandle = *INCmail; } if ( $incFlag eq "U" ) { $incHandle = *INCunix; } push ( @{$anchors{$incHandle}{$status}}, $incString ); #if ( $incFlag eq "N" ) { print INCnt "$incString\n"; } #if ( $incFlag eq "M" ) { print INCmail "$incString\n"; } #if ( $incFlag eq "U" ) { print INCunix "$incString\n"; } print $outHandle <<ROW; \n<table border=1 width="100%">\n <tr> <td colspan="12" align="left" valign="center" bgcolor="$colors{$sta +tus}" > <b><font size="+2"><a name=\"$class\.$titles{$status}\"</a>$clas +s: $titles{$status}</b></font> </td> </tr> ROW } ################################################################## # print include files for SSI sub printIncludes { my ( $incHandle, $status ); for $incHandle ( keys %anchors ) { for $status ( keys %{ $anchors{$incHandle}} ) { print $incHandle "@{ $anchors{$incHandle}{$status} }\n"; } } } ##################################################################
An example of %anchors:
$VAR3 = '*main::INCUNIX'; $VAR4 = { 'failed' => [ '<a href="#MII-AFS-Filesystem.Failed Jobs"><fo +nt color="#ff0000">MII-AFS-Filesystem</a></font><br>', '<a href="#MII-Media.Failed Jobs"><font color= +"#ff0000">MII-Media</a></font><br>', '<a href="#UNIX-ESMEC.Failed Jobs"><font color +="#ff0000">UNIX-ESMEC</a></font><br>' ], 'success' => [ '<a href="#DB_BACKUP.Successful Jobs"><font c +olor="#00ff00">DB_BACKUP</a></font><br>', '<a href="#HRMS-NT.Successful Jobs"><font col +or="#00ff00">HRMS-NT</a></font><br>', '<a href="#MII-AFS-Filesys-DR.Successful Jobs +"><font color="#00ff00">MII-AFS-Filesys-DR</a></font><br>', '<a href="#MII-Info.Successful Jobs"><font co +lor="#00ff00">MII-Info</a></font><br>', '<a href="#MII-Tuesday.Successful Jobs"><font + color="#00ff00">MII-Tuesday</a></font><br>' ] };

In reply to Problems writing to filehandles contained in variables by blink

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.