Re: qw(l i s t) vs (l, i, s, t)

[email protected] (Randal L. Schwartz)
Newsgroups gmane.comp.lang.perl.fun
Organization Stonehenge Consulting Services; Portland, Oregon, USA
Message-ID <[email protected]>
>>>>> "Tor" == Tor Hildrum <[email protected]> writes:

Tor> Could someone please explain what is happening here?

In older versions of Perl, qw(STRING) was implemented as a runtime
split(" ", STRING,) and inherited the scalar property of split(),
including the annoying warning under -w about the deprecated split
into @_.

In modern versions of Perl, the splitting happens at compile time, and
now acts like a comma-list, returning either a list in a list context,
or the last element of a list in a scalar context.

I think the break was Perl 5.6, or maybe 5.5.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.