if (length(substr($var, ' ')) eq length( $var)) {} might
be considered as well.
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:
if( $var eq ' ' x length($var) ) {...}
Should do the trick without regex or functions.
Yet another would be to use tr:
if( $var eq map tr/A..Za..z0..9/ /, $var ) {..}
or make that
if( $var eq map tr/\000..\277/ /, $var ) {..}
to be safe.
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:
if($var eq join '', map{ tr/\000..\177/ /c; $_; } split '', $var ) {
+...}
This is tested and it works. Note the use of c to complement. I wouldn't use this myself, though.
|