in reply to matching a defined lenght

I don't know exactly what you're trying to do, but substr will get you there. If you really don't care what's in it,

my $match = substr $string, 0, 30;
extracts the first thirty characters.

If you need some real matching, an expression like

substr($string, 0, 30) =~ /$re/
works fine. substr is an lvalue function, so that even works for substitution.

After Compline,
Zaxo