Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

(elbie): substr and strings on the outside

by elbie (Deacon)
on Aug 19, 2001 at 20:20 UTC ( #106033=note: print w/replies, xml ) Need Help??

in reply to substr and strings on the outside

Regex search and replace:

my $f = " "; $f =~ s/^(.{0,5}).{0,5}/${1}12345/;

The only problem is this regex doesn't pad extra spaces if your string is too short, but at least it still does the replacement.