use warnings; use strict; my @stats = stat 'foo'; if (@stats) { print "OK\n"; } else { print "Error\n"; }