Question: How to compare except the first digit of the string? Suppose I have 713 and 213, the return is 13.

another example:  

518 and 21 => no result  

423 and 413 => no result  

315 and 215 => 15  

Thanks

Answer: 
with this you can do:

```
if(substr($str1,1) eq substr($str2,1))

```

tested [here](http://ideone.com/rIprx1)
The `substr` operator will extract substrings for you. The second parameter of `substr` is the offset of the start of the substring that you want, so if you want the second character onwards you must say `substr $string, 1`.

This program takes your own data and puts the two numbers into `$i` and `$j`. Then `substr` is called twice to copy the second character onwards of those strings into `$i2` and `$j2`. The `if` statement compares the two values and prints output accordingly.

```
use strict;
use warnings;

for (
    '518 and 21',
    '423 and 413',
    '315 and 215') {

  my ($i, $j) = /\d+/g;

  my $i2 = substr $i, 1;
  my $j2 = substr $j, 1;

  if ($i2 eq $j2) {
    print "$i and $j => $i2\n";
  }
  else {
    print "$i and $j => no result\n";
  }
}

```

**output**

```
518 and 21 => no result
423 and 413 => no result
315 and 215 => 15

```