Closed p5pRT closed 20 years ago
The scalar operator does not change void context.
[D:\home\sthoenna]perl #!perl -wl sub context { print wantarray ? 'list' : defined wantarray ? 'scalar' : 'void'} my @x = scalar context; # works my $x = scalar context; # works scalar context; # doesn't work __END__ scalar scalar void
The scalar operator does not change void context.
[D:\home\sthoenna]perl #!perl -wl sub context { print wantarray ? 'list' : defined wantarray ? 'scalar' : 'void'} my @x = scalar context; # works my $x = scalar context; # works scalar context; # doesn't work __END__ scalar scalar void
Yitzchak Scott-Thoennes writes:
sub context { print wantarray ? 'list' : defined wantarray ? 'scalar' : 'void'} my @x = scalar context; # works my $x = scalar context; # works scalar context; # doesn't work __END__ scalar scalar void
What bothers you? void context is a (kind of a) scalar context.
Ilya
The scalar operator does not change void context.
This is because Perl_scalarvoid makes the scalar operator impart void context on its children. This seems extremely wrong indeed.
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review\, retransmission\, dissemination or other use of\, or taking of any action in reliance upon\, this information by persons or entities other than the intended recipient is prohibited. If you received this in error\, please contact the sender and delete the material from any computer.
The scalar operator does not change void context.
[D:\home\sthoenna]perl #!perl -wl sub context { print wantarray ? 'list' : defined wantarray ? 'scalar' : 'void'} my @x = scalar context; # works my $x = scalar context; # works scalar context; # doesn't work __END__ scalar scalar void
Migrated from rt.perl.org#3286 (status was 'resolved')
Searchable as RT3286$