in reply to Re: Why do I need -w in a cgi script
in thread Why do I need -w in a cgi script

Excellent answer. I would not have thought of the "/usr/bin/perl^M", but it makes perfcet sense.

I work in a Windows and Unix environment. One of the most simple yet useful things I've ever found on perlmonks was a slightly different version for stripping the ^M's. I use it all the time and it's very nice if you have multiple files that need cleanup.

perl -pi.bak -e 's/\cM//g' *.cgi

You don't really need the backup up, but it's nice when you first try it to know that you won't lose your data if it doesn't work.

Replies are listed 'Best First'.
Re: Why do I need -w in a cgi script
by jonadab (Parson) on Oct 09, 2003 at 16:06 UTC
    I work in a Windows and Unix environment. One of the most simple yet useful things I've ever found on perlmonks was a slightly different version for stripping the ^M's.

    I just ssh into the server and edit the files directly there, but for a more production-oriented environment I can see why some might not favor that approach, as a mis-edit could leave the script broken for a couple of minutes. In my situation this is not a big deal. Of course, if it were, I could have two directories on the server, one for development and one for production, which is probably what I'd do. Or have two servers.


    $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/