elusion has asked for the wisdom of the Perl Monks concerning the following question:
I started off with some code from programming perl 2nd edition. The only problem is that I end up having 80 some array values, most of which are just spaces. I can't seem to get rid of them. Does anyone have any ideas? Would I be better off getting input from a dir system command? If so, how should I do this? Thanx.opendir THISDIR, "." or die "serious dainbramagae: $!"; @allfiles = readdir THISDIR; closedir THISDIR; while (@allfiles) { $allfiles[0] =~ s/\s*\S+\.\S+\.*\S*\.*\S*\s*//; $array[$i] = $allfiles[0]; shift @allfiles; $i++ } shift @array; s/\s*//g; my $count = @array; $count++; while (@array2, $k<$count) { print "[$k] $array2[$j]\t"; $j++; $k++; }
- p u n k k i d
"Reality is merely an illusion, albeit a very persistant one."
-Albert Einstein
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Directory Listing
by plaid (Chaplain) on Jul 29, 2000 at 23:47 UTC | |
|
Re: Directory Listing
by athomason (Curate) on Jul 29, 2000 at 23:37 UTC | |
by elusion (Curate) on Jul 30, 2000 at 00:02 UTC | |
|
Re: Directory Listing
by fundflow (Chaplain) on Aug 10, 2000 at 01:13 UTC | |
by turnstep (Parson) on Aug 10, 2000 at 01:47 UTC | |
by tilly (Archbishop) on Aug 10, 2000 at 02:22 UTC | |
by jlp (Friar) on Aug 10, 2000 at 03:13 UTC |