in reply to Ignore certain return values

Note the difference between $result = get_values() and ($result) = get_values()
$ perl -wl sub get_values { return ('a', 'b', 'c'); } my $result = undef; $result = get_values(); print $result; ($result) = get_values(); print $result; __END__ c a
You should be aware of Context (perl.com). The wantarray builtin tells you the calling context:
$ perl sub check_context { # True if ( wantarray ) { print "List context\n"; } # False, but defined elsif ( defined wantarray ) { print "Scalar context\n"; } # False and undefined else { print "Void context\n"; } } my @x = check_context(); # prints 'List context' my %x = check_context(); # prints 'List context' my ($x, $y) = check_context(); # prints 'List context' my $x = check_context(); # prints 'Scalar context' check_context(); # prints 'Void context' __END__ List context List context List context Scalar context Void context
There are several modules that addresses context and return values, e.g. Contextual::Return.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]