A term coined by Larry Wall, The Perl Guru, to refer to the interesting patterns of slashes and backslashes often observed in regular expressions. For those not familiar with Perl, forward slash (/) is often used as a delimiter in search and replace operators (m//, s///) and backslash (\) as an escape character. When these delimiters are used in conjuction with strings including similar characters, you easily end up with obfuscated code.

A usual case of LTS occurs when you are searching for *nix paths:

if ( /^\/usr\/bin\/perl\b/ ) ...

The possibility to use any pair of non-alphanumeric, non-whitespace characters as delimiters may make your code a little easier to read since you don't have to escape every second character. Let's use exclamation point (!) instead of the usual slash to prevent LTS:

if ( m!^/usr/bin/perl\b! ) ...

Log in or register to write something here or to contact authors.