On Thu, May 22, 2014 at 1:40 PM, Manfred Lotz <[email protected]> wrote:
> Hi there,
> I want to check if a file is a plain file but not a symlink.
>
> It seems because -f returns true for a symlink that I have to do this:
> my $fname = 'somefile';
>
> if ( -f $fname and not -l $fname ) {
> say "$fname is a plain file";
> }
> Is there a simpler way to do this?
>
Potentially shorter and arguably simpler if you use the special
underscore argument to access file info for previous test, eg,
if ( -f $fname and not -l _ ) {
say...
}
--
Charles DeRykus
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/