http://www.perlmonks.org?node_id=1004468


in reply to New to perl and regex

if($line =~ /\s*([a-zA-Z]+\s*)+\s*(-?\d\d?)\s*/) ^

The problem description specifies “at least 1 or more white space” between the last word and the integer, but the regex has \s* (which is zero or more). This should be \s+ (one or more).

Apart from that, it’s difficult to offer advice without more information. Specifically, how is the code failing?

As Kenosis says, please provide some sample data (along with the desired output).

Athanasius <°(((><contra mundum