in reply to Ignore certain return values

But is this guaranteed?

No, not from the perspective of the sub's caller. It's dependent on the implementation of the sub.

For example, consider the following two functions that behave identically in list context.

>perl -le"sub f { 'a','b','c' } my @v=f(); print for @v" a b c >perl -le"sub f { my @a = ('a','b','c'); @a } my @v=f(); print for @v" a b c

In scalar context, however, they return drastically different results.

>perl -le"sub f { 'a','b','c' } my $v=f(); print $v" c >perl -le"sub f { my @a = ('a','b','c'); @a } my $v=f(); print $v" 3

If the sub doesn't define how it behaves in scalar context (which is the case for many subs that return lists), you have two options.