Does the following code give the same result in both cases?
use warnings; use strict; use Win32::DirSize; my $f = "d:\\programs"; print "Manual call\n"; dsize($f); my @file = ("d:\\programs"); print "Loop call\n"; foreach $f (@file) { dsize($f); } sub dsize { chomp (my $param = shift(@_)) ; print ">$param<\n"; #... }
Note that you should always use strict; use warnings; to catch problems as soon as possible (I'm not implying they will help in this case, however ...)
In reply to Re^5: Passing a string in a foreach loop
by GrandFather
in thread Passing a string in a foreach loop
by mat001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |