use IO::Handle; my $f = IO::Handle->new; opendir $f, '/tmp' or die $!; $f->sync or die "fsync: $!\n";