Hello rsFalse,
Is it true that ($match){1}+ equals to simply $match?
Yes, and the + does nothing here, as you can see with use warnings:
use strict; use warnings; chomp(my $match = <DATA>); chomp( $_ = <DATA>); for my $regex ( "($match){1}+", "($match){1}", "($match)", "($match)+", "($match)+?", ) { print qw(FAIL SUCCESS)[ !! m/\A $regex \z/x ], "\n" } __DATA__ (a|b){2} bbab
Output:
22:21 >perl 1345_SoPW.pl Useless use of greediness modifier '+' in regex; marked by <-- HERE in + m/\A ((a|b){2}){1}+ <-- HERE \z/ at 1345_SoPW.pl line 27, <DATA> li +ne 2. FAIL FAIL FAIL SUCCESS SUCCESS 22:21 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^4: about style: use possessive or atomic?
by Athanasius
in thread about style: use possessive or atomic?
by rsFalse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |