> 
> No information about the input that causes the
> error; are there also inputs 
> not causing an error?

Yes, the input expected would be:
" 32 11 25" or "32 11 25 " or " 32 11 25 " ...etc.

>  
> What you want is something like
> 
> /^\s*((?:\d+\s*?)+)\s*$/
> 
> The inner (?:) does not capture output (see perldoc
> perlre), 
> and the regex trims the input (which is allowed to
> contain leading and 
> trailing space)
>

This worked superbly for what I'm doing. :-) I found
reference to "?:" on page 204 of the "Camel Book", but
it isn't enough info to tell how to use it. I'm
looking into 'perldoc perlre' righ now. Thanks, for
giving me another resource. :-)

> The if-else could be shortened to (untested, so
> please check):
> 
> die "Bla" unless
> ($userIn)=$userIn=~/^\s*((?:\d+\s*?)+)\s*$/;
> 
Right; a lot shorter. Why, the parentheses around
$userIn?

> > my @numbers = split( / /, $userIn );
> 
> This only splits on a single space character.
> 
> my @numbers = split /\s+/, $userIn;
> 
> splits (explicitly) on the same whitespace allowed
> in the regex above.

I changed this too. Thanks, Hans!
> 
> [irrelevant parts snipped away]

Ron Smith
[EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to