#!/usr/bin/perl # # BCE Project 11 # use strict; use warnings; my $Directory = 'c:/data'; # Any directory containing files will do my @Farray; # Array of found files my $Pagelen = 20; # Page length (Number of items to print) sub printlist { my ( $Start, $End, @array ) = @_; $End = $End > @array ? @array : $End; printf "%s: %s\n", $_, $array[ $_ - 1 ] foreach $Start .. $End ; } ## end sub printlist opendir( DIR, $Directory ) || die "can't opendir $Directory: $!"; @Farray = sort grep { -f "$Directory/$_" } readdir(DIR); closedir DIR; print "Itemcount= scalar @Farray\n"; while (1) { print "Enter number: "; my $Input = ; last if $Input =~ m/^q/i; printlist $Input, $Input + $Pagelen - 1, @Farray; } ## end while (1)