note
dws
It looks like this is intended to be a CGI, and yet it doesn't emit the correct response header, so I'll assume this is just a code fragment.
<p>
What, exactly, do you expect
<code> @p{'eyes', 'hair', 'etc'} =();
</code>
to do? It rather looks like a syntax error to me. If you're trying to pre-load a hash with keys, you might try
<code> my %p;
$p{$_} = undef for qw(eyes hair etc);
</code>
But that begs the question of what your <code>do_print</code> is trying to do, since
<code> @p{ 'eyes', 'hair', 'etc' }
</code>
results in a three element array, with each element being <code>undef</code>. Assuming that you're trying to return the heading if and only if any one of the elements is present, you could do
<code> sub do_head {
my($heading, @data) = @_;
return "<h4>$heading</h4>" if grep { defined($_) } @data;
return "";
}
</code>
130850
130850