#!/usr/bin/perl -w <-- Not required on Windows, find -w arg??? # Perl v5.14.2 Last Edit GSR 2012-06-22 12:00 # # Create subroutine to make directories from ASCII file containing # a line of text without spaces representing the directories use strict; use warnings; use diagnostics; # use File::Path qw(make_path); <-- recommended by PerlMonks and works use File::Path qw(make_path remove_tree); # Scaler string my $GSR_dir = "F:/sandbox/"; # Scaler string my $GSR_file = "UPN_List12.06.02.txt"; # append the scalers / strings my $GSR_file2read = join ('/',$GSR_dir, $GSR_file,); # Ok, lets go open(my $GSR_fh, "<", $GSR_file2read) or die "cannot open <, String: $!"; # this reads the content of the file handle (file) into the array variable # but a pointer to the file handle is at the end of the file so any # subsequent use of <$GSR_fh> yields null my @thefiles = <$GSR_fh>; # see if we have list in var # print @thefiles; <-- Works so we use that array # See if we have string in vars # print $GSR_dir; <-- Works # print $GSR_file; <-- Works # Using line below proved the module loaded and executed.... # make_path 'F:/sandbox/123_water'; # Line below creates directories in resident directory of program execution make_path ( map {chomp; $_} @thefiles ); # Can join append string to the file I want made? close $GSR_fh;