in reply to wisdom needed for string matching and array processing

Given the example text you did it appears that you've got "dogs, cats, 4, 8". When you split on "," you'll have spaces at the beginning of your items, hence your anchored regex will fail (e.g. " 4" will not match /^\d+$/). You either need to allow optional spaces there or add them to your split delimiter so they're removed when you split. See perldoc perlre in either case.

Replies are listed 'Best First'.
Re^2: wisdom needed for string matching and array processing
by sierrastar (Sexton) on Nov 07, 2005 at 00:06 UTC
    thank you! I added
    $str=~s/\s+//g;
    and I removed any whitespace... I know perl is soooo easy for you monks but I struggle...it doesn't help that the course is online and I never really get instruction...but I am making slow progress! thanks again! sierra