#!perl use strict; use warnings; use FileHandle; use File::Spec; my $install_dir = File::Spec->catdir('C:', 'Program Files (x86)'); my $file = File::Spec->catfile($install_dir, 'perl-test.txt'); my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($install_dir); print $mode; my $fh = FileHandle->new($file, '>'); if( defined $fh ) { $fh->print("bar\n"); $fh->close(); }else{ die("Error: $!"); }