in reply to Re^3: Pulling first 10 characters out of string?
in thread Pulling first 10 characters out of string?

What's happening is that "$x =~ /^(.{10)/" is matching the first ten characters, and copying them into $1 for future use. If you want to replace $x, you want one of
$x =~ s/^(.{10}).*/$1/; ($x) = $x =~ /^(.{10})/; $x = substr($x, 0, 10); susbstr($x, 10) = '';
Any of them work, so use whichever style you like most (personally, I think I prefer the last one).