perlsecret | The perl secret operators | Reflection library
kandi X-RAY | perlsecret Summary
kandi X-RAY | perlsecret Summary
perlsecret - perl secret operators and constants. perl has a long tradition of giving nicknames to some of its operators (possibly a form of huffmanisation). these nicknames are based on the appearance of the operator, rather than its function. the well-known examples are the "diamond operator" <> and the "spaceship operator" <=> . the perl "secret operators" have been discovered (or created) by perl obfuscators and golfers, usually when looking for a shorter way to perform a given operation. secret operators are not actually secret, and they are not actually operators either. the perl parser does not specifically recognise them, and no one is trying to hide them from you. but they are like operators in the sense that these perl programmers see them often enough
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of perlsecret
perlsecret Key Features
perlsecret Examples and Code Snippets
Community Discussions
Trending Discussions on perlsecret
QUESTION
According to perlsecret, the goatse operator =()=
provides a list context so that it can count the number of its elements. I used to think that too. But when I accidentally use the operator along with split
, I noticed something strange.
The first two lines of following, are exact same statements written in Effective Perl Programming, 2nd edition
. But as a matter of fact, it seems split
changes behavior by the left side.
ANSWER
Answered 2020-Jan-20 at 17:36It's documented in split further down where LIMIT is discussed:
when assigning to a list, if LIMIT is omitted (or zero), then LIMIT is treated as though it were one larger than the number of variables in the list;
It's an optimization so Perl doesn't create values it would then throw away immediately. Just imagine $varX
instead of undef
.
To avoid this optimization, specify a limit of -1:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install perlsecret
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page