Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: extracting words with certain characters

by rjt (Deacon)
on Dec 04, 2012 at 11:24 UTC ( #1007065=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    use Benchmark qw/:all/;
    ...
    
    my @words = $code =~ /_[\w_]* | [a-zA-Z]\w*_\w*/gx;
    print "\nWords: ", join(', ', @words);
    
  2. or download this
                Rate split  grep regex
    split 10581141/s    --  -22%  -49%
    grep  13630260/s   29%    --  -34%
    regex 20760455/s   96%   52%    --
    
    Words: is_, _be, some_sample, __code, __0K__, _, _, _
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-07-05 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls