$test = "$5.1"; $grammar = q { input: dollar decimal dollar : /\$/ { $item[1] } decimal : /[-+]?(\d+)?\.\d+/ { warn "decimal! $item[1]" } ...