...the print statement print $outhandle (as well as subsequent others) don't actually print to the filehandle. The problem is not with %classHash; I've checked that it is being populated as I expect. But, if I do this:# # open report files for printing my $filepath = "/usr/openv/scripts"; open *NTOUT, ">>$filepath/nt.html" or die "cannot open nt file for +writing: $!\n"; open *UNIXOUT, ">>$filepath/unix.html" or die "cannot open unix file +for writing: $!\n"; open *MAILOUT, ">>$filepath/mail.html" or die "cannot open mail file +for writing: $!\n"; # # some unrelated code ...... # foreach my $class ( sort keys %classHash ) { if ( $classHash{$class} = "NT" ) { $outhandle = *NTOUT; } if ( $classHash{$class} = "UNIX" ) { $outhandle = *UNIXOUT; } if ( $classHash{$class} = "MAIL" ) { $outhandle = *MAILOUT; } foreach my $status ( sort keys %{ $classHash{$class} } ) { if ( $status eq "success" ) { print $outhandle <<SUC; <table border=1 width="100%"> <tr> <td colspan="12" align="left" valign="center" bgcolor="#33cc +33"> <b><font size="+1">$class: Successful Jobs</b></font> </td> </tr> SUC
It does print to each filehandle. What am I doing wrong, here?@fh = ( *NTOUT,*UNIXOUT, *MAILOUT ); foreach (@fh) { print $_ <<EOC; <html> <head> <title>[Backup report] $humanstart - $humanstop</title> </head> <body bgcolor="#ffffff"> <h2 align="left">Daily Backup Report</h2> <h3 align="left">From $humanstart to $humanstop</h3> EOC }
In reply to typglobs and filehandles by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |