in reply to Parse for a Single bit

How about this?

use strict; use warnings; while( <DATA> ) { if( /^(\w)='[01]$/ ) { print "$1 "; } } print "\n"; __DATA__ a='0 b='001 c='110 d='1

Despite your subject line mentioning "single bit", the code you present looks more like you're trying to find those strings that have only a single character consisting of 0 or 1 after the =', so that's the tack I took.

One more note: please, when posting code here, do us the courtesy of making it presentable from a formatting standpoint. The code tags (which you used) are one step. But they're the final step. An earlier step ought to be to follow some basic indentation strategy. And the step before that is to fix syntax errors such as in your while loop.


Dave