in reply to wisdom needed for string matching and array processing
if($arr[$i]=~/^d+$/){
Should be
if($arr[$i]=~/^\d+$/){
(Although as a matter of style, I would probably rewrite the whole loop as follows:)
for( @arr ) { # if the element contains only digits if( /^\d+$/ ) { $_ /= 2; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: wisdom needed for string matching and array processing
by sierrastar (Sexton) on Nov 07, 2005 at 00:24 UTC | |
by skx (Parson) on Nov 07, 2005 at 05:31 UTC |