https://www.google.com/accounts/o8/id?id=AItOawmEFmsULh5l4dO4ek5K2NQ-8wcJG99nGOA
Recent Actions
-
Commented on Huh. Multiple beginning-of-line anchors work
> I don't think you understand what brian is demonstrating is not obvious based on just what the documentation you quoted says. Most people do not automatically think of using multiple ^ anchors to match subsequent lines. Sure, but it...
-
Commented on Huh. Multiple beginning-of-line anchors work
It seems that a lot of people just uses regex modifier without even knowing what they meant. You use "/xmg" as a modifier. The /m modifier means: From the perlre documentation: > Treat string as multiple lines. That is, change...
-
Commented on Book Report - December 2014
Sid Burn: You didn't really need any module at all to explain classes. I would say, someone only has really understand object-orientation if he knew how to code OO in an imperative or functional style. And that is the most...
-
Commented on Are Abilities Roles?
To answer your first question if Ability should be a role. No it shouldn't. Just having an Ability class is fine. Another point, you said a ability where you can't change the name is of no use. Why? In whatever...
Comment Threads
-
Davs commented on
Are Abilities Roles?
Wow, really good comment about roles vs inheritance!
-
A. Sinan Unur commented on
Huh. Multiple beginning-of-line anchors work
I don't think you understand what brian is demonstrating is not obvious based on just what the documentation you quoted says. Most people do not automatically think of using multiple ^ anchors to match subsequent lines.
The ^ and $ anchors are generally used as in the simplified example of:
my @matches = $string =~ m/ ^ This\ is\ (\S.+) $ /xm;
with brian's example will result in:
Matches are line one a cat a dog a bird
which corresponds to your "So sure, it does work on multiple lines."
brian uses the two ^…
-
A. Sinan Unur commented on
Huh. Multiple beginning-of-line anchors work
I messed up the pattern in my example (too early here), but the point still holds:
my @matches = $string =~ m/ ^This\ is\ a\ (\S+) /xmg;
will print
Matches are cat dog bird
as opposed to brian's example which only matches in case of two subsequent lines that match the pattern.
-
A. Sinan Unur commented on
Huh. Multiple beginning-of-line anchors work
We are in agreement. Just note that any programming language has a bazillion details. No one can remember everything, and the subsets people can constantly keep in their heads vary across time and people.
It so happens that I frequently doubt my memory and/or understanding of various details of a specific language. In those cases, just trying out alternatives, and seeing what they do is a great way to remember the detail for the next time.
-
Aristotle commented on
Huh. Multiple beginning-of-line anchors work
I would have been surprised if it didn’t work that way.
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.