first problem is your assigning a scalar to an an array
Should be
my $i = "l-12345.in.some.domain.com";
Second, your question seems a bit vague, do you know which two things you need to match?
If so you should be able to say
$i =~/($first)\.($second)/;
Now $first is in $1 and $second is in $2 if they where found.
Of course this doesn't take into account boundaries.
If $first = "dog" and $second ="com" this will match fogdog.com as well. You need to determine what your boundaries are going to be.
-Lee
"To be civilized is to deny one's nature."