#!/usr/bin/env perl use strict; use warnings; use Fcntl qw[]; my $path = '/etc/passwd'; my @stat = stat $path or die $!; printf "%s\n", -l $path ? 1 : 0; # 0 - OK, not a link printf "%s\n", Fcntl::S_ISLNK( $stat[2] ) ? 1 : 0; # 0 - OK, not a link printf "%s\n", Fcntl::S_IFMT( $stat[2] ) & Fcntl::S_IFLNK ? 1 : 0; # 1 - ERROR __END__