Results 1 to 2 of 2

Thread: CGI/Perl -> Replace <CR> with \r\n

  1. #1

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    CGI/Perl -> Replace <CR> with \r\n

    hey ya,

    OK, how do i replace <CR> with \r\n in CGI?

    I thought that

    Code:
    $Description = "This is <CR> LINE ONE <CR>LINE 2<CR> LINE THREE";
    
    $Description =~ s/<CR>/\r\n/g;
    should do it? (Seams like not though)

    NE 1?

    [oh btw this code:]

    Code:
           $input{'a_text'} = "Line\r\n1\r\n2\r\n3";
           $input{'a_text'} =~ s/\r\n/<CR>/g;
    makes it output to:
    Line<CR>1<CR>2<CR>3
    Wayne

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    It works fine for me. Are you writing to a file? Perhaps Perl is translating the \r\n to the line breaker of your OS?
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width