<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 5, 2015 at 2:01 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>...<br><br></div></div>Can I check to see if any of the hash's element is defined without checking all the elements as the hash could grow in the future as the fields of the form grow.<br></div></div><a href="http://mail.pm.org/mailman/listinfo/chicago-talk" rel="noreferrer" target="_blank"></a></blockquote><div><br></div><div>That sounds like a premature optimization to me. Even the low-level internals of Perl hashes don't know which of their contents are defined. But, since it looks like you construct the hash, I would bet that you could check the return value of param() before adding it to the hash. Something like this comes to mind (untested):<br><br></div><div>my %input_hash = map { my $val = param($_); $val ? ($_ => $val) : () } qw(firstname lastname email);<br><br></div><div>You can then get the number of elements by getting the number of keys, or values, in scalar context:<br><br></div><div>my $N_field_filled_out = scalar(keys %input_hash);<br><br></div><div>David<br></div></div><br><br clear="all"><br>-- <br><div class="gmail_signature"> "Debugging is twice as hard as writing the code in the first place.<br>
   Therefore, if you write the code as cleverly as possible, you are,<br>
   by definition, not smart enough to debug it." -- Brian Kernighan<br></div>
</div></div>