in reply to how to check

Read perlintro
if ( -f $path ) { print "do something, its a file\n"; }