I'm wondering how I can extract all tokens matching a regular expression in perl and put them in a list? I saw a nifty example on stackoverflow, but I can't find it again (argh!!)
So, suppose:
my $cppString = " boost::fancyFunc( widget->dooHicky());"
I'd like to be able to extract all \w+ tokens from string. But, maybe later I might want to just extract all tokens that look like "\w+::\w+", or "\w+->\w".
Anyways, what is the readable compact way of doing this given a regexp?
The example (which I can't find) looked something like this:
my @cppTokens = ($cppString =~ m/(regexp)/g);
Anyways, the above example is not exactly right.
thanks.