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

Re: [ID 20000407.005] Problem with `scalar()' trying to count undefined elements

Thread Previous
From:
Tom Hughes
Date:
April 10, 2000 15:57
Subject:
Re: [ID 20000407.005] Problem with `scalar()' trying to count undefined elements
Message ID:
3da344ad49.tom@compton.compton.nu
In message <Pine.GSO.4.21.0004101735130.16448-100000@crusoe.crusoe.net>
          Jeff Pinyan <jeffp@crusoe.net> wrote:

> On Apr 10, Jeff Pinyan said:
>
> >qw() is synactically split ' ', q(), and split in scalar context piddles
> >around with @_ and returns @_ (in scalar context, believe it or not).
>
> That was before 5.6, of course.  qw() behaves similarly, but creates a
> list at compile time -- read perldelta to find out how this changes your
> life in many exciting ways.

Indeed. Hence in 5.6 you get 30 and not 3 for the second example:

gosford [~] % perl5.6.0 -le 'print scalar(qw(10 20 30))'
30

Tom

-- 
Tom Hughes (tom@compton.nu)
http://www.compton.nu/
...Power is poison.


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