in reply to Explanation of Perl one-liner required

This is indeed a peculiar structure which will universally fix old Text::CSV installations and upgrade them. You can read more about it by doing perldoc Text::CSV::Upgrade (you will need a version of Text::CSV newer than 0.59, if you don't have that installed, just download it from CPAN and execute the command in the untarred directory).

Replies are listed 'Best First'.
Re^2: Explanation of Perl one-liner required
by CountZero (Bishop) on Sep 28, 2009 at 12:21 UTC
    I do not agree. A modern Text::CSV will use the XS-version if available and the Pure Perl version if XS is not available. So there is no need to "upgrade" your scripts. As per the docs:
    Text::CSV provides facilities for the composition and decomposition of comma-separated values using Text::CSV_XS or its pure Perl version.

    If there is anything you should do, then it is to replace Text::CSV_XS by Text::CSV to make your script more universally applicable.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      You're missing the context. He doesn't have a modern Text::CSV, and it's easier instructing this particular monk to install Text::CSV_XS (simple ppm command) than to have him upgrade Text::CSV (which would require installation of make tools, an exercise requiring at least 5 posts to explain to this monk).
        Text::CSV (v.1.13) is available on the Activestate PPM site for Perl 5.8 and 5.10, so it is easy to install as Text::CSV_XS

        Update: I see, Win still must have a Perl 5.6 for which indeed there is no modern Text::CSV available; but then again for Perl 5.6 there is no Text::CSV_XS available AT ALL on the ActiveState PPM it seems. So the substitution trick won't work I'm afraid.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re^2: Explanation of Perl one-liner required
by Anonymous Monk on Sep 28, 2009 at 11:21 UTC
    Forgot, sorry, the more correct invocation is

    perl -peb.cak -we"s{Text::CSV}{Text::CSV_XS}g" xx.pm
        No typo, just a persistant case of lazy trolling on the part of the OP. Try searching for acronyms :-)