```{index} single: s_ifmt; Fcntl function ``` ```{index} single: Fcntl::s_ifmt; Perl function ``` # s_ifmt Extract the file-type bits from a stat-mode value. ## Synopsis ```perl my $type = S_IFMT($mode); my $mask = S_IFMT(); # the mask constant itself ``` Called with an argument, returns `$mode & S_IFMT` — the bits that classify the file (regular, directory, symlink, ...). Called with no argument, returns the mask constant, which is how Perl code commonly compares against `S_IFREG`, `S_IFDIR`, and friends. ## Examples ```perl use Fcntl qw(:mode); my $mode = (stat $path)[2]; print "is a directory\n" if S_IFMT($mode) == S_IFDIR; ```