in reply to Re: Open a folder
in thread Open a folder
Hi, thank you for the help. I am not completely sure what your code is does, but the
next if $entry eq '.'; next if $entry eq '..';
did help. I have combined your code with something of another user to come up with this:
#!/usr/bin/perl -w use strict; use warnings; open (Output, ">Output.txt") or die "Can't open"; my $tmp_dir= 'C:\Users\ZB\Desktop\Text Files'; opendir (DIR, $tmp_dir) or die $!; while (my $file_name = readdir(DIR)) { next if $file_name eq '.'; next if $file_name eq '..'; print "$file_name\n"; } close (Output) closedir(DIR);
All it does is print all the file names in my directory as output(so at least I am on the right path). However I want to iterate through each text file and do some basic calculations(all in 1 sub) within each file. Any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Open a folder
by ww (Archbishop) on Jan 08, 2013 at 14:53 UTC | |
|
Re^3: Open a folder
by blue_cowdawg (Monsignor) on Jan 08, 2013 at 14:51 UTC | |
by Dr Manhattan (Beadle) on Jan 09, 2013 at 06:15 UTC | |
by blue_cowdawg (Monsignor) on Jan 09, 2013 at 14:04 UTC |