in reply to fixed length string

Perl doesn't have a data type with that behaviour, but you could try something like:

use strict; my ($len, $str) = (5, "someword"); $str = sprintf "%-${len}.${len}s", $str; print ">>$str<<\n";
s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&;