Peter Scott writes:
> Hey, waitaminute.  That isn't a list in sub fn in the first place; it's 
> three expressions separated by scalar commas.  Why is there no complaint 
> about useless use of a constant in void context?
> 
> $ perl -Mstrict -wle 'sub f{return(3,5,7)} my $x = f()'
> $ perl -Mstrict -wle 'my $x = (3,5,7)'
> Useless use of a constant in void context at -e line 1.
> Useless use of a constant in void context at -e line 1.
> $
> 
> If context propagates through subroutine calls why no warning?

Context of subroutine calls isn't known until runtime:

  $x = f();     # scalar
  @x = f();     # list

The warning you're talking about is a compiletime warning.

Nat

Reply via email to