Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: I was expecting 4 elements in the array, but it only has 3

by Paladin (Vicar)
on Nov 28, 2018 at 17:08 UTC ( #1226461=note: print w/replies, xml ) Need Help??


in reply to I was expecting 4 elements in the array, but it only has 3

The difference is context, scalar vs. list.

The m// operator returns the empty list on no match in list context and the list (1) in list context when there are no () in the regex.

So after evaluating all the matches in @list you are left with ((1), (), (1), (1)), which evaluates to (1,1,1).

Replies are listed 'Best First'.
Re^2: I was expecting 4 elements in the array, but it only has 3
by haukex (Archbishop) on Nov 28, 2018 at 17:13 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1226461]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-12-10 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (38 votes). Check out past polls.

    Notices?