On Tue, Oct 30, 2001 at 12:49:06PM -0500, Jeff 'japhy' Pinyan wrote:
> If you want PRINTABLE non-words characters, then you probably want:
>
> @non_words = grep /\W/, map chr, 33 .. 126;
I would suggest:
use POSIX qw(isprint);
@non_words = grep { isprint($_) && /\W/ } map chr, 0 .. 255;
or, for 5.6 users who don't want to pull in POSIX.pm:
@non_words = grep { /[[:print:]]/ && /\W/ } map chr, 0 .. 255;
Though, strangely, they give slightly different results; the latter returns
36 characters, the former 32. [[:isprint:]] matches such things as \t, \n,
\r, etc., i.e. printable whitespace, whereas POSIX::isprint does not.
Either way, though, it assumes less about the character set.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]