On Oct 30, Stephen LeClaire said:

>What I was looking for, but not properly describing, was a way to fill
>an array with non-word characters - much like "@array = ( 'a' .. 'b'
>);"  would be used to fill with lowercase characters.

The simplest way I can think of is:

  @non_words = grep /\W/, map chr, 0 .. 255;

That builds a list of the numbers 0 through 255, turns them into the
characters they represent, and then checks to see if they match the
non-word regex.  If you want PRINTABLE non-words characters, then you
probably want:

  @non_words = grep /\W/, map chr, 33 .. 126;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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

Reply via email to