I’ve been writing Perl code since just after I learned to walk, so I’m always looking for ways to do things in a Perl-ish manner. My latest requirement was an equivalent to the perl chop() command to remove the last character of a string for PHP. After a bit of searching around, it appears the best way to do this is:

$string = substr($string, 0, -1);

This method avoids unnecessary interpolation overheads (apparently)!