http://qs321.pair.com?node_id=598

Current Perl documentation can be found at perldoc.perl.org.

Here is our local, out-dated (pre-5.6) version:

There are many ways. If you just want to grab a copy, use substr():

    $first_byte = substr($a, 0, 1);

If you want to modify part of a string, the simplest way is often to use substr() as an lvalue:

    substr($a, 0, 3) = "Tom";

Although those with a pattern matching kind of thought process will likely prefer:

    $a =~ s/^.../Tom/;