>Using an AoA:
>
>for my $cfg ( @cfgs ) {
> my $fileIn = "$cfgDir/$cfg->[0]/tapelist";
> open FILEIN, '<', $fileIn or die "Could not open $fileIn: $!";
> print +( reverse <FILEIN> )[ -$cfg->[1] .. -1 ]; }
>
>Using a hash:
>
>for my $cfg ( keys %cfgs ) {
> my $fileIn = "$cfgDir/$cfg/tapelist";
> open FILEIN, '<', $fileIn or die "Could not open $fileIn: $!";
> print +( reverse <FILEIN> )[ -$cfg{$cfg} .. -1 ]; }
>
>
>Also, if the files are large you can get better efficiency using
>the File::ReadBackwards module.
Thanks for the solutions John, works a treat. Files are quite small but
will look into File::ReadBackwards
Regards,
Greg.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>