Bullock, Howard A. [EMAIL PROTECTED] wrote:
> My script slurps in a file 
> 
> Local $/;
> $data = <FILE>;
> 
> and want to remove the CRLF's. but even a simple RegEx match does not
> succeed for me.
> 
> These all have failed.
> 
> print "\nYES\n" if $data =~ /\015\012/;
> print "\nYES\n" if $data =~ /\015\012/s;
> print "\nYES\n" if $data =~ /\x0D\x0A/;
> print "\nYES\n" if $data =~ /\x0D\x0A/s;
> print "\nYES\n" if $data =~ /\r\n/;
> print "\nYES\n" if $data =~ /\r\n/s;
> 
> What I am doing wrong?

Without seeing more of the code, it is hard to say.
But here's some approaches:

1. Make sure $data has any contents (i.e. the read worked as expected).
Add these two lines. Does the length equal the file size? Do you see
multiple lines?

  print "len=", length( $data ), "\n";
  print "data='$data'\n";

2. Make sure your file has CRLF's. I'd use Cygwin's "od" command.
You should look for \r \n in the output of this command.

  od -c datafilename

If the file was generated on a Mac, your probably see \r as line
terminators.
If the file was generated under Unix, your should see \n as line
terminators.
Some old oddball machines actually used \n \r.

3. Doh! Just noticed that you wrote: "Local $/;" . Maybe it is a typo
or your email client auto capalitalized. It must be lowercase:

  local $/;

--
Mike Arms

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

Reply via email to