On Mon, May 11, 2009 at 18:55, AndrewMcHorney <andrewmchor...@cox.net> wrote: > Hi > > I appreciate the assistance from a previous email message on writing > functions in Perl. The issue right now is that I am passing an array, a > number and a string to the function but it does not appear to be passed > successfully. I am sure the error is quite simple. The function in question > is build_string. Any assistance would be greatly appreciated. > > Thanks, > Andrew snip
Having read your code, passing parameters is the least of your worries. Your main difficulty comes from the fact that you are using the dos dir command instead of the File::Find[1] module. You should also be using the strict[2] and warnings[3] pragmas. You will also want to look at the file test operators[4]. All of them are Core Perl, so you won't need to install anything. #!/usr/bin/perl use strict; use warnings; use File::Find; my @files; my $directories = 0; my $files = 0; my $size = 0; find sub { if (-d) { $directories++; return; } if (-f) { $files++; $size += -s; return; } print "$File::Find::name is not a directory or file\n"; }, "c:\\"; print "there were $directories directories\n", "there were $files files\n", "their total size was $size\n"; 1. http://perldoc.perl.org/File/Find.html 2. http://perldoc.perl.org/strict.html 3. http://perldoc.perl.org/warnings.html 4. http://perldoc.perl.org/functions/-X.html -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/