Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: regexp list return 5.6 vs 5.8

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


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

You're right about the behavior of slices, but it has nothing to do with subroutine returns. See for example:

perl -e"my @a=qw/a b c/; print scalar @a[0..2]" c
The issue is that an array (or hash, or list) slice in scalar context returns the last element of the slice. I feel like this should be documented in perldata but a quick read of it just now didn't reveal any such indication.


Comment on Re^3: regexp list return 5.6 vs 5.8
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-08-22 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (156 votes), past polls