in reply to Re: The first two number
in thread The first two number

That's wrong. If you run the program, and ignore the warnings it issues, you'll see that $var2 ends up being 77. But it's not the first two numbers - it's the first number repeated twice. (Test it by setting $var to '7').

The problem is your incorrect usage of $1, which is undefined (Correct would be \1). Since $1 is undefined, the regex becomes /((\d))/, putting the first number in both $1 and $2.