in reply to Re: Fast morphing of SYBASE data to flat-file
in thread Fast morphing of SYBASE data to flat-file

you're asking Perl to compile each of the regular expressions again every time the subroutine sasify is called. You can avoid this with the "/o" operator
This is a common misconception. In fact, the regular expressions are compiled once, at the same time as the rest of the program. The /o modifier makes a difference only when the RE includes a variable interpolation: in that case, it means the RE will contain the value of the variable at its first use, and will not change, regardless of whether the variable changes or not. In this case, since the REs are static strings, there is no re-compilation involved.

Replies are listed 'Best First'.
Re^3: Fast morphing of SYBASE data to flat-file (say "no" to /o)
by tye (Sage) on Mar 13, 2003 at 19:06 UTC

    I'd like to add to this, "Just don't use /o!"

    It was useful in Perl4. In Perl5 it is not very useful (the performance gain it provides is small and not as good as that provided by better alternatives) and it is confusing to the point of causing bugs.

    If you haven't identified a performance problem, then don't worry about it. If you have, then use qr// (if you have regular expression that contain variables).

                    - tye