I don't really know that much about perl, but since the example file uses "User-agent" without the capital A, and the regular expression checks for capital A, you  wouldn't be getting any matches...

what's even worse you could get dissalowed path's for user-agent string you  wouldn't want... how ? consider:

User-Agent: *
Disallow: a

#next line doesn't match a new user-agent
User-agent: Mozilla
Disallow: /extra/private/secret/path

That would dissalow the secret path to all agent strings...