|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Should I use v5.10 because of named groups?by hrcerq (Monk) |
| on Apr 13, 2021 at 22:11 UTC ( [id://11131226]=perlquestion: print w/replies, xml ) | Need Help?? |
|
hrcerq has asked for the wisdom of the Perl Monks concerning the following question: Hello again. I've got a script that uses named capture groups to parse file records. The record format is always the same (four fields wide, colon separated), just like a passwd file (except for the number of fields). For example: 0:1:bob:Bob 1:1:bob:Bob 1:0:alice:Alice You get the idea. At first I used to split it, but later I came to the conclusion that using a regex with named groups could provide a more understandable code. The (simplified) example below might help you get the picture.
Now, I've noticed (according to perlretut) that named capture groups were introduced in Perl 5.10. I don't expect the script to run in older versions, but would it be wise to use v5.10 pragma? Would it have any unwanted side effects? I'm not using any of the features of the bundle, just wanted to state that version 5.10 is required. Is that a good idea?
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||