develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [perl #22027] undef appears as scalar return value for a list

Thread Previous
From:
Mike Stok
Date:
April 24, 2003 07:53
Subject:
Re: [perl #22027] undef appears as scalar return value for a list
Message ID:
Pine.LNX.4.44.0304241050390.7042-100000@ratdog.stok.co.uk
On 24 Apr 2003, Mike Stok wrote:

> I may be being an idiot here, so feel free to tell me that I am.

I managed to delete the output from the program while rehashing the 
message.
 
> use strict;
> use warnings;
> 
> sub show {
>     print defined $_[0] ? $_[0] : '(undef)', "\n";
> }
> 
> my $rv = ('a', 'b', 'c');
> show $rv;
> my $rv2 = ('a', 'b', 'c', ());
> show $rv2;

produced 

[mike@ratdog tmp]$ perl try.pl
Useless use of a constant in void context at try.pl line 10.
Useless use of a constant in void context at try.pl line 10.
Useless use of a constant in void context at try.pl line 12.
Useless use of a constant in void context at try.pl line 12.
Useless use of a constant in void context at try.pl line 12.
c
(undef)

Apologies,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA 
mike@exegenix.com                  | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.exegenix.com/           |                  75D2 9EC4 C1C0 0599 13DA


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About