Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: regexp list return 5.6 vs 5.8

by Errto (Vicar)
on Jan 24, 2008 at 18:49 UTC ( #664114=note: print w/ replies, xml ) Need Help??


in reply to Re: regexp list return 5.6 vs 5.8
in thread regexp list return 5.6 vs 5.8

What do you mean exactly? What kind of "array-specific" behavior are you trying to avoid? If you want to take data you are creating as a list but apply it in scalar context, you need to make some decision for yourself about what data you want and code accordingly. For example, map operates on a list and returns a list. If you want to use that in scalar context, and want something other than the length of the list as the value, you need to decide what you want. If you always want the last value, one way to do that is

my $scalar = (map { some code } some list)[-1];


Comment on Re^2: regexp list return 5.6 vs 5.8
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-04-19 03:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (477 votes), past polls