mat001 has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a foreach loop with the Win32-DirSize PM. If I provide $f directly the script finds the size of the directory, however when I have a list of directories in a file and open the the script does not find the $f input.
Please help.
dir.txt = [ dir1.txt, dir2.txt, dir3.txt] use Win32::DirSize; open (FILE, "dir.txt") || die "can not open file\n"; chomp (@file = <FILE>); close FILE; #$f = "dir1"; # If I unpound this and pound out the foreach #loop work +s. foreach $f (@file) { my $Result = dir_size( $f, my $DirInfo, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing a string in a foreach loop
by GrandFather (Saint) on Oct 20, 2005 at 03:49 UTC | |
by mat001 (Initiate) on Oct 20, 2005 at 03:56 UTC | |
by GrandFather (Saint) on Oct 20, 2005 at 04:05 UTC | |
by GrandFather (Saint) on Oct 20, 2005 at 04:08 UTC | |
by mat001 (Initiate) on Oct 20, 2005 at 04:16 UTC | |
by GrandFather (Saint) on Oct 20, 2005 at 06:17 UTC | |
| |
|
Re: Passing a string in a foreach loop
by blazar (Canon) on Oct 20, 2005 at 09:22 UTC |