Perl function.

lc [EXPR]

Returns a lowercase version of its argument, or $_ if given no arguments. Note that . has a higher precedence than lc, so something like $foo = lc "ABC . "DEF" will yield "abcdef" instead of "abcDEF". I mention this only because I seem to do it every time I use lc.

lc $foo is equivalent to "\L$foo".

For example:

sub word_cap {
  $string = shift;
  $string =~ s/\b(\w+)\b/ucfirst lc $1/gie;
  return $string;

See also lcfirst, uc, and ucfirst, or Perl for the full function list.

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