CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
CGI: ^M at the end of line, how to delete this ?

 



Ruru_atwork
Deleted

Mar 21, 2001, 12:35 AM

Post #1 of 2 (385 views)
CGI: ^M at the end of line, how to delete this ? Can't Post

Hello,

this is the result when i execute this script via CGI

/:os.hpux.fs:90:none:80:none:70:none^M
/home:os.hpux.fs:99:none:97:none:95:none^M
...
..
this is the script:
#!/opt/perl5/bin/perl
use CGI;
$q = new CGI;
@a = $q->param ();
$p = $q->param($a[0]);

open (FSFILE, ">/tmp/web_ar_fs_res$$");
#binmode (FSFILE);
printf FSFILE "$p" ;
close (FSFILE);

print $q->start_html(-title=>'');
system ("cat -v /tmp/web_ar_fs_res$$");
print $q->end_html();

i try with binmode but this is the same result.
How to delete ^M (or have not this character) ?


ok , i found that on forum
$p =~ s/\r//g;



(This post was edited by Ruru_atwork on Mar 20, 2001, 11:56 PM)


unknownSym
stranger

Mar 21, 2001, 12:22 PM

Post #2 of 2 (379 views)
Re: CGI: ^M at the end of line, how to delete this ? [In reply to] Can't Post

See if this helps:

$p =~ s/\s*$//g;

But now when you print the value of $p to the file use:

print FSFILE "${p}\n";

See if those two changes will work.

--unknownSym


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives