Note also that [+-]{2} is not equivalent to \+\+|-- as the former matches "-+" while the latter doesn't. Also, the original code will remove a leading "(--" from the line, while your code will not (it will either remove a leading '(' or a leading '--', '-+', '+-' or '--'). Finally, a /g modifier is useless if the pattern is anchored to the beginning of the string. And, if you're golfing, you shouldn't make a capture if you aren't using the result.
Your s/// could be written as:
My entry (untested):s/^\(?([-+])\1//
I do think the 80 is a bit arbitrary, andperl -nE'/\(?([-+])\1.*?(\S{3,80}->\S{5,80})/&&say$2' *|sort -u
is not only shorter, but likely to be preferred.perl -nE'/\(?([-+])\1.*?(\S{3,}->\S{5,})/&&say$2' *|sort -u
In reply to Re^2: Print all derefs and method calls in a directory (Friday golf)
by JavaFan
in thread Print all derefs and method calls in a directory (Friday golf)
by jepri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |