All,

To remove CRTL-M's try this:

perl -pi -e 's/\cM$//g' file.pl

And, it's done.

Ozette

[EMAIL PROTECTED] wrote:
> Send Perl-Win32-Users mailing list submissions to
>       [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>       http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> or, via email, send a message with subject or body 'help' to
>       [EMAIL PROTECTED]
>
> You can reach the person managing the list at
>       [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Perl-Win32-Users digest..."
>
>
> Today's Topics:
>
>    1. RE: download window instead of executing (Hoopes, William @ CSE)
>    2. control M's (Chris Rodriguez)
>    3. Re: control M's (Javier Nunez (DHL US))
>    4. Re: control M's (Phil Brewer)
>    5. Re: control M's (Javier Nunez (DHL US))
>    6. RE: control M's (John Townsend)
>    7. RE: control M's (Jack D)
>    8. Re: control M's (Chris Wagner)
>    9. Re: download window instead of executing (Chris Wagner)
>   10. RE: control M's (Chris Rodriguez)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 25 Jun 2007 15:31:26 -0400
> From: "Hoopes, William @ CSE" <[EMAIL PROTECTED]>
> Subject: RE: download window instead of executing
> To: <[email protected]>
> Message-ID:
>       <[EMAIL PROTECTED]>
> Content-Type: text/plain;     charset="us-ascii"
>
> I'm sure others have a more elegant way of doing it, but make this the
> first thing you print to stdout:
>
> print "Content-Type: text/html\n\n";
> print "\n";
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Dan Jablonsky
> Sent: Monday, June 25, 2007 1:37 PM
> To: [email protected]
> Subject: download window instead of executing
>
> hi all,
> just a quick questions: why do I get a download window
> when I'm trying to execute a .pl file in the browser?
> It's something very simple but I forgot how one fixes
> this.
>
> I'll get back with details if necessary,
> kowalsky
>
>
>  
> ________________________________________________________________________
> ____________
> Luggage? GPS? Comic books? 
> Check out fitting gifts for grads at Yahoo! Search
> http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 25 Jun 2007 13:40:43 -0700 (PDT)
> From: Chris Rodriguez <[EMAIL PROTECTED]>
> Subject: control M's
> To: [EMAIL PROTECTED]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi everyone,
>   I wrote a cgi script in PERL which won't execute.  I'm told it's  because I 
> have control M's at the end of each line, and that this  happens when editing 
> programs in Windows (which I do, with  Notepad).  I found a free program on 
> the web  (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which  
> claims to remove them.  I ran it and uploaded the new program, but  it still 
> doesn't work.  It may be that there's another problem  with the script, then 
> again, maybe the control M's are still  there.  I'd like to rule out the 
> latter.  Can anyone advise  me on dealing with this?  How can I remove them?  
> How can I  tell if they're there or not?  How can I type up a script so that  
> they never appear in the first place, etc.?
>   
>   Thank you,
>   Chris
>   
>        
> ---------------------------------
> Boardwalk for $500? In 2007? Ha! 
> Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-users/attachments/20070625/7327e20b/attachment-0001.html
>  
>
> ------------------------------
>
> Message: 3
> Date: Mon, 25 Jun 2007 13:55:39 -0700
> From: "Javier Nunez (DHL US)" <[EMAIL PROTECTED]>
> Subject: Re: control M's
> To: <[EMAIL PROTECTED]>,      <[EMAIL PROTECTED]>
> Message-ID:
>       <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="utf-8"
>
> One of several ways is 
>
> Vi the file in Unix (assuming you try to run it there) then
>
> Shift :
> 1,$s/<press Ctrl - v> M//g
>
> This will remove all Ctrl-M in the file
>
> You can script this very easy
>
> Saludos
> Javier
> Javier Nunez
> Principal Systems Support Engineer
> [EMAIL PROTECTED]
> +1 (480) 375-6263
> DHL ITSC Americas
>
> ----- Original Message -----
> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Sent: Mon Jun 25 13:40:43 2007
> Subject: control M's
>
> Hi everyone,
> I wrote a cgi script in PERL which won't execute.  I'm told it's because I 
> have control M's at the end of each line, and that this happens when editing 
> programs in Windows (which I do, with Notepad).  I found a free program on 
> the web (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which 
> claims to remove them.  I ran it and uploaded the new program, but it still 
> doesn't work.  It may be that there's another problem with the script, then 
> again, maybe the control M's are still there.  I'd like to rule out the 
> latter.  Can anyone advise me on dealing with this?  How can I remove them?  
> How can I tell if they're there or not?  How can I type up a script so that 
> they never appear in the first place, etc.?
>
> Thank you,
> Chris
>
>
> ________________________________
>
> Boardwalk for $500? In 2007? Ha! 
> Play Monopoly Here and Now 
> <http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow>
>   (it's updated for today's economy) at Yahoo! Games.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-users/attachments/20070625/3cd5acc9/attachment-0001.html
>  
>
> ------------------------------
>
> Message: 4
> Date: Mon, 25 Jun 2007 22:10:47 +0100
> From: "Phil Brewer" <[EMAIL PROTECTED]>
> Subject: Re: control M's
> To: "Chris Rodriguez" <[EMAIL PROTECTED]>,
>       <[EMAIL PROTECTED]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> We use a free editor, Metapad Lite 
> (http://www.liquidninja.com/metapad/download.html). This enables you to save 
> files as DOS Text (CR+LF), Unix Text (LF), Unicode or Unicode (Big Endian).
> Are you sure the CRs are the problem?
>
> Phil Brewer
> Trivex Systems
>   ----- Original Message ----- 
>   From: Chris Rodriguez 
>   To: [EMAIL PROTECTED] 
>   Sent: Monday, June 25, 2007 9:40 PM
>   Subject: control M's
>
>
>   Hi everyone,
>   I wrote a cgi script in PERL which won't execute.  I'm told it's because I 
> have control M's at the end of each line, and that this happens when editing 
> programs in Windows (which I do, with Notepad).  I found a free program on 
> the web (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which 
> claims to remove them.  I ran it and uploaded the new program, but it still 
> doesn't work.  It may be that there's another problem with the script, then 
> again, maybe the control M's are still there.  I'd like to rule out the 
> latter.  Can anyone advise me on dealing with this?  How can I remove them?  
> How can I tell if they're there or not?  How can I type up a script so that 
> they never appear in the first place, etc.?
>
>   Thank you,
>   Chris
>
>
>
> ------------------------------------------------------------------------------
>   Boardwalk for $500? In 2007? Ha! 
>   Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! 
> Games.
>
>
> ------------------------------------------------------------------------------
>
>
>   _______________________________________________
>   Perl-Win32-Users mailing list
>   [email protected]
>   To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-users/attachments/20070625/d930c69e/attachment-0001.html
>  
>
> ------------------------------
>
> Message: 5
> Date: Mon, 25 Jun 2007 14:14:35 -0700
> From: "Javier Nunez (DHL US)" <[EMAIL PROTECTED]>
> Subject: Re: control M's
> To: <[EMAIL PROTECTED]>,      <[EMAIL PROTECTED]>
> Message-ID:
>       <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="utf-8"
>
> Or you can get Crisom editor (download it for free) and save it on Unix 
> format and that will take the Ctrl-M as well
>
> Saludos
> Javier
>
> Javier Nunez
> Principal Systems Support Engineer
> [EMAIL PROTECTED]
> +1 (480) 375-6263
> DHL ITSC Americas
>
> ----- Original Message -----
> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Sent: Mon Jun 25 13:40:43 2007
> Subject: control M's
>
> Hi everyone,
> I wrote a cgi script in PERL which won't execute.  I'm told it's because I 
> have control M's at the end of each line, and that this happens when editing 
> programs in Windows (which I do, with Notepad).  I found a free program on 
> the web (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which 
> claims to remove them.  I ran it and uploaded the new program, but it still 
> doesn't work.  It may be that there's another problem with the script, then 
> again, maybe the control M's are still there.  I'd like to rule out the 
> latter.  Can anyone advise me on dealing with this?  How can I remove them?  
> How can I tell if they're there or not?  How can I type up a script so that 
> they never appear in the first place, etc.?
>
> Thank you,
> Chris
>
>
> ________________________________
>
> Boardwalk for $500? In 2007? Ha! 
> Play Monopoly Here and Now 
> <http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow>
>   (it's updated for today's economy) at Yahoo! Games.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-users/attachments/20070625/cc42b937/attachment-0001.html
>  
>
> ------------------------------
>
> Message: 6
> Date: Mon, 25 Jun 2007 15:37:50 -0700
> From: "John Townsend" <[EMAIL PROTECTED]>
> Subject: RE: control M's
> To: "Chris Rodriguez" <[EMAIL PROTECTED]>,
>       <[EMAIL PROTECTED]>
> Message-ID:
>       <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
>
> For Windows, I'm fond of the text editor Ultra Edit. It is not expensive
> and I've been using it for years.
>  
> (For Mac heads, I suggest BBEdit--I'd use it on Windows if they made a
> Win version)
>
> ________________________________
>
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Chris Rodriguez
> Sent: Monday, June 25, 2007 1:41 PM
> To: [EMAIL PROTECTED]
> Subject: control M's
>
>
> Hi everyone,
> I wrote a cgi script in PERL which won't execute.  I'm told it's because
> I have control M's at the end of each line, and that this happens when
> editing programs in Windows (which I do, with Notepad).  I found a free
> program on the web
> (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which
> claims to remove them.  I ran it and uploaded the new program, but it
> still doesn't work.  It may be that there's another problem with the
> script, then again, maybe the control M's are still there.  I'd like to
> rule out the latter.  Can anyone advise me on dealing with this?  How
> can I remove them?  How can I tell if they're there or not?  How can I
> type up a script so that they never appear in the first place, etc.?
>
> Thank you,
> Chris
>
>
> ________________________________
>
> Boardwalk for $500? In 2007? Ha! 
> Play Monopoly Here and Now
> <http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?g
> amekey=monopolyherenow>  (it's updated for today's economy) at Yahoo!
> Games.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-users/attachments/20070625/dfa28c6b/attachment-0001.html
>  
>
> ------------------------------
>
> Message: 7
> Date: Mon, 25 Jun 2007 17:28:28 -0600
> From: "Jack D" <[EMAIL PROTECTED]>
> Subject: RE: control M's
> To: "'Chris Rodriguez'" <[EMAIL PROTECTED]>,
>       <[EMAIL PROTECTED]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain;     charset="us-ascii"
>
> The problem likely occurs when you "upload" (assuming you meant ftp when you
> said that. Ensure you ftp the file in "ASCII" mode when going from windows
> to unix or vice versa. This will automatically remove any CR's.
>
> http://en.wikipedia.org/wiki/Newline#Common_problems
>
> Jack
>
>
> ________________________________
>
>       From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Chris Rodriguez
>       Sent: Monday, June 25, 2007 2:41 PM
>       To: [EMAIL PROTECTED]
>       Subject: control M's
>       
>       
>       Hi everyone,
>       I wrote a cgi script in PERL which won't execute.  I'm told it's
> because I have control M's at the end of each line, and that this happens
> when editing programs in Windows (which I do, with Notepad).  I found a free
> program on the web
> (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which claims to
> remove them.  I ran it and uploaded the new program, but it still doesn't
> work.  It may be that there's another problem with the script, then again,
> maybe the control M's are still there.  I'd like to rule out the latter.
> Can anyone advise me on dealing with this?  How can I remove them?  How can
> I tell if they're there or not?  How can I type up a script so that they
> never appear in the first place, etc.?
>       
>       Thank you,
>       Chris
>       
>
>       ________________________________
>
>       Boardwalk for $500? In 2007? Ha! 
>       Play Monopoly Here and Now
> <http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamek
> ey=monopolyherenow>  (it's updated for today's economy) at Yahoo! Games.
>
>
>
>
> ------------------------------
>
> Message: 8
> Date: Mon, 25 Jun 2007 21:51:54 -0400
> From: [EMAIL PROTECTED] (Chris Wagner)
> Subject: Re: control M's
> To: [EMAIL PROTECTED]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
>
> That's a common problem with DOS versus unix file format.  U can use the
> commandline tool dos2unix to convert it after u upload it.  DOS creates new
> lines explicitly with the sequence CRLF while unix just uses LF (making the
> CR implicit).
>
> A simple workaround so that the file remains valid on both Windows and unix
> is to add -I/dev/null to the shebang line at the beginning of the script.
> This is a fix because it's the trailing CR at the end of that line that's
> messing up ur script.  The system is looking for an interpretor literally
> named "/usr/bin/perl^M".  It's blindly splitting the line on LF characters.
> The -I/dev/null will "eat" the CR at the line's end allowing the system to
> locate /usr/bin/perl.
>
> So like this:
> #!/usr/bin/perl -I/dev/null
>
> This doesn't hurt anything since /dev/null can never affect ur program on
> unix and it simple doesn't exist on Windows.  U can tell if they're there or
> not by viewing the file with vi/vim on the unix box.  It will print them as
> ^M if present.
>
>
> At 01:40 PM 6/25/2007 -0700, Chris Rodriguez wrote:
>   
>> Hi everyone,
>>  I wrote a cgi script in PERL which won't execute.  I'm told it's  because
>>     
> I have control M's at the end of each line, and that this  happens when
> editing programs in Windows (which I do, with  Notepad).  I found a free
> program on 
>
>
>
>
> --
> REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
> "...ne cede malis"
>
> 00000100
>
>
>
> ------------------------------
>
> Message: 9
> Date: Mon, 25 Jun 2007 22:01:31 -0400
> From: [EMAIL PROTECTED] (Chris Wagner)
> Subject: Re: download window instead of executing
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
>
> At 10:36 AM 6/25/2007 -0700, Dan Jablonsky wrote:
>   
>> just a quick questions: why do I get a download window
>> when I'm trying to execute a .pl file in the browser?
>> It's something very simple but I forgot how one fixes
>> this.
>>     
>
> Hi. What do u mean by execute in the browser?  That doesn't make sense.  Are
> u trying to run the script as a CGI and have it print its output to the
> browser? If so then u don't have the script in the web server's CGI
> directory.  If u want to have the script execute anywhere, not just in the
> CGI dir, u have to enable script aliasing in the webserver's configuration
> so that it will recognize .pl as an executable extension.
>
>
>
>
> --
> REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
> "...ne cede malis"
>
> 00000100
>
>
>
> ------------------------------
>
> Message: 10
> Date: Tue, 26 Jun 2007 06:32:17 -0700 (PDT)
> From: Chris Rodriguez <[EMAIL PROTECTED]>
> Subject: RE: control M's
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Thanks everyone for the overwhelming response!  I tried Jack's  solution 
> first because it was so easy.  It turns out there's a  simple button on my 
> ftp window to choose between binary or ASCII (or  Auto).  Voila!  Works like 
> a charm!  This has been  immensely helpful!
>   Chris
>   P.S. Thanks also, Jack, for including the link to an explanation for  why 
> this happens.  Interesting how 'un-standardized' computers  are.  I guess 
> it's still a new technology.
>
> Jack D <[EMAIL PROTECTED]> wrote:  The problem likely occurs when you 
> "upload" (assuming you meant ftp when you
> said that. Ensure you ftp the file in "ASCII" mode when going from windows
> to unix or vice versa. This will automatically remove any CR's.
>
> http://en.wikipedia.org/wiki/Newline#Common_problems
>
> Jack
>
>
> ________________________________
>
>  From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Chris Rodriguez
>  Sent: Monday, June 25, 2007 2:41 PM
>  To: [EMAIL PROTECTED]
>  Subject: control M's
>  
>  
>  Hi everyone,
>  I wrote a cgi script in PERL which won't execute.  I'm told it's
> because I have control M's at the end of each line, and that this happens
> when editing programs in Windows (which I do, with Notepad).  I found a free
> program on the web
> (http://www.scriptarchive.com/scripts/snippets/rm_cont_m.pl) which claims to
> remove them.  I ran it and uploaded the new program, but it still doesn't
> work.  It may be that there's another problem with the script, then again,
> maybe the control M's are still there.  I'd like to rule out the latter.
> Can anyone advise me on dealing with this?  How can I remove them?  How can
> I tell if they're there or not?  How can I type up a script so that they
> never appear in the first place, etc.?
>  
>  Thank you,
>  Chris
>
>        
> ---------------------------------
> You snooze, you lose. Get messages ASAP with AutoCheck
>  in the all-new Yahoo! Mail Beta. 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-users/attachments/20070626/f43a3f38/attachment-0001.html
>  
>
> ------------------------------
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
> End of Perl-Win32-Users Digest, Vol 11, Issue 15
> ************************************************
>
>
>   


-- 
O------------
Ozette Brown
Product Engineer
BidX.com || Info Tech, Inc.
Phone: 352.381.4888
Fax: 352.381.4444
Email: [EMAIL PROTECTED]
Website: http://www.bidx.com


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to