Hi all,

Thanks for the input!

The following is the answer I was looking for and was provided by an Anonymous Monk.
Thank you!

my (%r) = map { $_ => $f{$_} } $left .. $right;

And what I am doing!
"Brain Cell Exercise Project 11"

#!/usr/bin/perl # # BCE Project 11 # use strict; use warnings; my $Directory = '/usr/bin'; # Any directory containing files will do my %Fhash; # Numbered file list hash my @Farray; # Array of found files my $Itemcount = 0; # Count of files found my $File; # my $Pagelen = 20; # Page length (Number of items to print) my $Input; # sub printlist { my %Thash; my $Start = $_[0]; my $End = $_[1]; my $Item; if ($End > $Itemcount) { $End = $Itemcount; } %Thash = map { $_ => $Fhash{$_} } $Start .. $End; foreach $Item (sort{$a <=> $b} keys %Thash) { printf "%s :%s\n", $Item, $Thash{$Item}; } } opendir(DIR, $Directory) || die "can't opendir $Directory: $!"; @Farray = grep { -f "$Directory/$_" } readdir(DIR); closedir DIR; # Create serialized hash of the files... foreach $File (sort sort{$b cmp $a} @Farray) { $Fhash{ ++$Itemcount } = "$Directory/$File"; } print "Itemcount=", $Itemcount, "\n"; while (1) { print "Enter number: "; my $Input = <STDIN>; chomp $Input; if ( $Input =~ m/^q/ ) { # q to quit last; } printlist $Input, $Input + $Pagelen - 1; }

Ultimately the goal is to page (or line by line) up and down through the list, and enter a number to select a file.
Just have not gotten that far yet.

This is a Brain Cell Exercise so, Any pointers to cleaner, neater, slicker methods would be VERY WELCOME and will be appreciated!

-Enjoy
fh : )_~


In reply to Re: A hash of a range of another hash by Anonymous Monk
in thread A hash of a range of another hash by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.