in reply to The first two number

If as stated earlier you are looking for the first match that is a doubled number, I would do it like this:
#!/usr/local/bin/perl -w use strict; my $var = '77373737377837'; my @new_var = $var =~ /((\d)$1)/; my $var2 = join('', @new_var);

Please next time try to phrase your question more clearly.

Replies are listed 'Best First'.
Re^2: The first two number
by Anonymous Monk on Feb 21, 2005 at 10:36 UTC
    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.