perlfaq nodetype
faq_monk
<P>
There are many ways. If you just want to grab a copy, use
<CODE>substr():</CODE>
<P>
<PRE> $first_byte = substr($a, 0, 1);
</PRE>
<P>
If you want to modify part of a string, the simplest way is often to use
<CODE>substr()</CODE> as an lvalue:
<P>
<PRE> substr($a, 0, 3) = "Tom";
</PRE>
<P>
Although those with a pattern matching kind of thought process will likely
prefer:
<P>
<PRE> $a =~ s/^.../Tom/;
</PRE>
<P>