Returns the casefolded version of EXPR. This is the internal function implementing the\F escape in double-quoted strings.
Casefolding is the process of mapping strings to a form where case differences are erased; comparing two strings in their casefolded form is effectively a way of asking if two strings are equal, regardless of case.
Roughly, if you ever found yourself writing this
lc($this) eq lc($that) # Wrong! # oruc($this) eq uc($that) # Also wrong! # or$this =~ /^\Q$that\E\z/i # Right!Now you can write
fc($this) eq fc($that)And get the correct results.
Perl only implements the full form of casefolding, but you can access the simple folds using"casefold()" in Unicode::UCD and"prop_invmap()" in Unicode::UCD. For further information on casefolding, refer to the Unicode Standard, specifically sections 3.13Default Case Operations, 4.2Case-Normative, and 5.18Case Mappings, available athttp://www.unicode.org/versions/latest/, as well as the Case Charts available athttp://www.unicode.org/charts/case/.
If EXPR is omitted, uses$_.
This function behaves the same way under various pragmas, such as within"use feature 'unicode_strings", aslc does, with the single exception offc ofLATIN CAPITAL LETTER SHARP S (U+1E9E) within the scope ofuse locale. The foldcase of this character would normally be"ss", but as explained in thelc section, case changes that cross the 255/256 boundary are problematic under locales, and are hence prohibited. Therefore, this function under locale returns instead the string"\x{17F}\x{17F}", which is theLATIN SMALL LETTER LONG S. Since that character itself folds to"s", the string of two of them together should be equivalent to a single U+1E9E when foldcased.
While the Unicode Standard defines two additional forms of casefolding, one for Turkic languages and one that never maps one character into multiple characters, these are not provided by the Perl core. However, the CPAN moduleUnicode::Casing may be used to provide an implementation.
fc is available only if the"fc" feature is enabled or if it is prefixed withCORE::. The"fc" feature is enabled automatically with ause v5.16 (or higher) declaration in the current scope.
Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.