in reply to Handling undefined string content
Jeroen
"We are not alone"(FZ)
Update Read lemming's reply. Forget the substr approach. Luckily, I thought of another approach on the way home:
Should do the trick without regex or functions.if( $var eq ' ' x length($var) ) {...}
Yet another would be to use tr:
or make thatif( $var eq map tr/A..Za..z0..9/ /, $var ) {..}
to be safe.if( $var eq map tr/\000..\277/ /, $var ) {..}
Update2: lemming's update hits it once more. I confused the foreach behavior with map's. Moreover, I should have evaluated in array context. Well, you get this:
This is tested and it works. Note the use of c to complement. I wouldn't use this myself, though.if($var eq join '', map{ tr/\000..\177/ /c; $_; } split '', $var ) { +...}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Handling undefined string content
by lemming (Priest) on Feb 01, 2001 at 00:24 UTC |