Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: regexp list return 5.6 vs 5.8

by hipowls (Curate)
on Jan 24, 2008 at 10:21 UTC ( #663979=note: print w/replies, xml ) Need Help??


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

Strange indeed.

michael$ perl t.pl {{} {} {123} {123}

Replies are listed 'Best First'.
Re^6: regexp list return 5.6 vs 5.8
by johngg (Canon) on Jan 25, 2008 at 10:15 UTC
    Putting the call inside a @{[ ... ]} construct does something different.

    print "[@{ [ scalar test('abc') ] }]\n"; print "[", scalar test('abc'), "]\n\n"; print "[@{ [ test('abc') ] }]\n"; print "[", test('abc'), "]\n\n"; print "[@{ [ scalar test('123') ] }]\n"; print "[", scalar test('123'), "]\n\n"; print "[@{ [ test('123') ] }]\n"; print "[", test('123'), "]\n"; sub test { my @rv = $_[0] =~ /^([0-9]+)$/; return @rv[ 0 .. $#rv ]; }

    produces

    [ ] [[] [] [] [123] [123] [123] [123]

    Running 5.8.4 on Solaris 9.

    Cheers,

    JohnGG

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2020-10-20 05:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (208 votes). Check out past polls.

    Notices?