--- Madhu Reddy <[EMAIL PROTECTED]> wrote:
> Date: Mon, 7 Jul 2003 10:39:51 -0700 (PDT)
> From: Madhu Reddy <[EMAIL PROTECTED]>
> Subject: ASCII Manipulation in perl
> To: [EMAIL PROTECTED]
>
> Hi,
> I want to write following C Equivalant with PERL
> My perl equvalant is at the end of this mail..
> please correct me...
> my questios are inside perl comments...
>
> ----------
> C Code start
> -----
> for(i=0;i<(int)strlen(Buffer);i++)
> {
> if((Buffer[i] < 32) || (Buffer[i] > 126))
> {
> if((Buffer[i] == 10) || (Buffer[i] == 13))
> {
> Buffer[i] = '\0';
> }
> else
> {
> BadRec = 1;
> if(Buffer[0] != 26)
> {
> BadCnt++;
> fprintf(Reject,"%s\n",Buffer);
> }
> else
> Ignore++;
> }
> break;
> }
> }
> ----------------
> PERL CODE START
> ---------------
> for(split(//)){
> if ((ord() < 32) || (ord() < 126)) {
> if (ord() == 10) || (ord() == 13)) {
> #make this char as NULL
> # here how to make this char is NULL ?
> # $_ =~ tr/\r\n/\0\0/; is this Correct ?
> } else {
> $badrec = 1;
> # if ord() of first char is not 26
> # reject reocrd
>
> }
> }
> }
>
>
> Thanks in Advance
> -Madhu
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]