|
uG posted:
Instead of trying to wrestle that regex into doing what you want, you might try to break it into smaller pieces. Something like: Perl code:
Extortionist fucked around with this message at 23:01 on Apr 29, 2014 |
# ¿ Apr 29, 2014 22:51 |
|
|
# ¿ May 15, 2024 15:26 |
|
uG posted:I tried that after getting frustrated with this but it doesn't iterate over the matches like I want. The code you posted lacks negative lookahead so it will take "penalty smu 10 yards blah blah, penalty msu 5 yards", then the first match will be "penalty smu 10 yards blah blah, penalty", leaving "msu 5 yards" not to get iterated over. Adding negative lookahead leaves the (.*?) (aka $1 aka $penalty_phrase) to always capture nothing. Perl code:
|
# ¿ Apr 30, 2014 00:01 |
|
Hughmoris posted:Thanks for this. Those are good suggestions if you're married to perl for whatever reason, but you might look elsewhere if you're looking for more general learning.
|
# ¿ Feb 5, 2016 02:59 |
|
Mithaldu posted:Entirely disagree. I really think someone new to OO programming would be better off learning its paradigms in a language where its paradigms are more commonly used and are more strictly enforced.
|
# ¿ Feb 6, 2016 12:06 |
|
Mithaldu posted:You're reflecting on the people involved, the learning resources they chose and your own lack of knowledge on quality OO Perl learning resources; not on anything inherent to Perl. In which case, yeah, i agree. If the person learning is generally lazy, and happy to start learning from the first google hit that presents to them, it's a good recommendation to go with a language that puts them in a straight-jacket. Otherwise Perl is fine to learn OO with, especially when sticking to the links i gave. Perl's flexibility is a huge handicap against learning (yes, I am arguing that the issue here is something inherent to perl). I don't think it has much to do with the laziness you imply, so much as it has to do with the difficulty of learning various concepts and perl's willingness to let you put together something that entirely contradicts best practices but also solves the problem you're trying to solve (this is probably also one of perl's biggest strengths--just not so much when it comes to learning). I deal with the consequences of this too often in my daily work to assume that someone trying to learn something blindly in such a permissive language will magically fall into best practices. Surely someone can do it if they're smart and diligent enough--but probably they'd also have an easier time of it if the language didn't fool them about what they were doing. I will stand by my assertion that perl's OO support is hacked. The core language plainly isn't designed to properly support OO, and you can easily blow apart any OO code in perl intentionally or accidentally.
|
# ¿ Feb 8, 2016 12:35 |