Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^8: Use of wantarray Considered Harmful

by ikegami (Pope)
on Dec 19, 2008 at 23:04 UTC ( #731686=note: print w/ replies, xml ) Need Help??


in reply to Re^7: Use of wantarray Considered Harmful
in thread Use of wantarray Considered Harmful

m//g always returns a list - what you do with that list is your decision.

Aside from the fact that it's impossible for an operator to return a list in scalar context, m//g behaves quite differently in scalar and in list context.

It can act as an iterator (which I think you consider as being the same as a list for the discussion):

while (/.../g) { ... }

But it's not an iterator in this tokenizer:

/\G( ... )/g or die; my $token1 = $1; /\G( ... )/g or die; my $token2 = $1; ...


Comment on Re^8: Use of wantarray Considered Harmful
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-07-25 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (174 votes), past polls