Does the 'o' modifier for Perl regular expressions still provide any benefit?

后端 未结 6 1828
醉话见心
醉话见心 2020-11-29 07:48

It used to be considered beneficial to include the \'o\' modifier at the end of Perl regular expressions. The current Perl documentation does not even seem to list it, cert

6条回答
  •  庸人自扰
    2020-11-29 08:43

    In the Perl 5 version 20.0 documentation http://perldoc.perl.org/perlre.html it states

    Modifiers
    
    Other Modifiers
    
    …
    
    o - pretend to optimize your code, but actually introduce bugs
    

    which may be a humorous way of saying it was supposed to perform some kind of optimisation, but the implementation is broken.

    Thus the option might be best avoided.

提交回复
热议问题