I have Perl on Mac, Windows and Ubuntu. How can I tell from within the script which one is which? Thanks in advance.
Edit: I was asked what I am doi
#Assign the $home_directory variable the path of the user's home directory
my $home_directory = ($^O eq /Win/) ? $ENV{HOMEPATH} : $ENV{HOME};
#Then you can read/write to files in the home directory
open(FILE, ">$home_directory/my_tmp_file");
print FILE "This is a test\n";
close FILE;
#And/or read the contents of the file
open(FILE, "<$home_directory/my_tmp_file");
while (){
print $_;
}
close FILE;