Madhu Reddy wrote:
> 
> Hi,

Hello,

>   I want to check for some ASCII chars in perl like
> following "C" code..

The following code checks for "printable" characters not ASCII
characters.


> How to do this in Perl ?
> follwing will work in perl ?
> 
> for($i=0;$i < length;$i++) {
> if (($_[$i] < 32) || (($_[$i] > 126)) {
> print "Char is non printable char\n";
> }
> }

Assuming the current line is in $_:

print "This line contains non-printable characters.\n"
    if /[^[:print:]]/;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to