Hi Monks!
I am passing values to a subroutine and sometimes in my code I don't need to pass all the values expected by the sub, and I know I am getting an "Use of uninitialized value..." from the expected values in the subroutine. OK here is the passing sample code:
... my $info = send_values( { name => $name, address => $address, id => $id, pic => $pic, } ); ...

Here is the sample sub code:
... sub send_values{ my ($args) = @_; #test: my $values = "Your Results are:\n $args->{name}\n $args->{address}\n $args->{pic}\n $args->{id}\n $args->{zip}\n $args->{phone}\n "; }

These two "$args->{zip} and $args->{phone}" will give me warnings on "use of uninitialized value" because I am not passing them. Can I use some sort of "if @_ defined" to prevent this issue?
Thanks for the help!

In reply to Subroutine question on use of uninitialized value. by Anonymous Monk

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