Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

•Re: m//g in list context

by merlyn (Sage)
on Aug 08, 2002 at 22:17 UTC ( #188764=note: print w/replies, xml ) Need Help??


in reply to m//g in list context

To get what you want, use:
$" = ", "; $string = "a:b:c"; @list = ($string =~ m/(?=(\w):(\w))/g); print "list=@list\n";
The lookahead operator will keep restarting where the previous match left off.

-- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2019-07-20 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?