in reply to Change a String's Element

If you "use strict;" it would tell you that @packet is different from $packet.

You can accomplish what you want by

substr($packet,0,1) = "X";

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis