Hi All,
    I am very new to Perl, but I sense a great adventure ahead after just
programming with Cobol, Pascal, and C over the last umpteen years. I have
written a perl script where I am trying to detect a non-printing
character(Ctrl@ - Ctrl_) and then substitute  a printing ASCII sequence such
as "^@" in its place, but it does not seem to work as I would like. Any
advice would be greatly appreciated.

         Thank You....Eric Sand


$in_ctr=0;
$out_ctr=0;

while ($line = <STDIN>)
    {
    chomp($line);
    $in_ctr ++;
    if ($line = s/\c@,\cA,\cB,\cC,\cD,\cE,\cF,\cG,\cH,\cI,\cJ,\cK,
                  \cL,\cM,\cN,\cO,\cP,\cQ,\cR,\cS,\cT,\cU,\cV,\cW,
                  \cX,\cY,\cZ,\c[,\c\,\c],\c^,\c_
                 /^@,^A,^B,^C,^D,^E,^F,^G,^H,^I,^J,^K,
                  ^L,^N,^N,^O,^P,^Q,^R,^S,^T,^U,^V,^W,
                  ^X,^Y,^Z,^[,^\,^],^^,^_/)
        {
        $out_ctr ++;
        printf("Non-printing chars detected in: %s\n",$line);
        }
    }
printf("Total records read                                 = %d\n",$in_ctr);
printf("Total records written with non-printing characters =
%d\n",$out_ctr);

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to