On Fri, May 26, 2006 at 10:35:41AM +1000, Keenan, Greg John (Greg)** CTR **
wrote:
> >Using a hash:
> >
> >for my $cfg ( keys %cfgs ) {
> >my $fileIn = "$cfgDir/$cfg/tapelist";
> >open FILEIN, '<', $fileIn or die "Could not open $fileIn: $!";
> >print +( reverse )[ -$cfg{$cfg} .. -1
>Small correction: because of the hyphens those barewords need to be quoted.
>
>my @cfgs = (
>[ Toaster=> 6 ],
>[ 'MFG-UNIX' => 5 ],
>[ 'SYS-UNIX' => 5 ],
>[ 'Amanda-Daily' => 1 ],
>);
>
>my %cfgs = (
>Toaster=> 6,
>'MFG-UNIX' => 5,
>'SYS-
John W. Krahn wrote:
> Keenan, Greg John (Greg)** CTR ** wrote:
>>
>>my $cfgDir = '/amanda/admin/etc/amanda';
>>my @cfgs = qw(Toaster MFG-UNIX SYS-UNIX Amanda-Daily);
>>my %numTapes = (
>> "$cfgs[0]" => 6,
>> "$cfgs[1]" => 5,
>> "$cfgs[2]" => 5,
>> "$cfgs[3]" => 1,
>> );
>
> Do you really ne
>Using an AoA:
>
>for my $cfg ( @cfgs ) {
>my $fileIn = "$cfgDir/$cfg->[0]/tapelist";
>open FILEIN, '<', $fileIn or die "Could not open $fileIn: $!";
>print +( reverse )[ -$cfg->[1] .. -1 ]; }
>
>Using a hash:
>
>for my $cfg ( keys %cfgs ) {
>my $fileIn = "$cfgDir/$cfg/tapelist";
>
Joshua Colson wrote:
> On Fri, 2006-05-26 at 09:45 +1000, Keenan, Greg John (Greg)** CTR **
> wrote:
>>
>>my $cfg;
>>foreach $cfg (@cfgs) {
>>my $fileIn="$cfgDir/$cfg/tapelist";
>>open (FILEIN, "<$fileIn") or die ("Could not open $fileIn: $!");
>>my @lines = reverse ;
>>my $line;
>
Keenan, Greg John (Greg)** CTR ** wrote:
> Hi,
Hello,
> What is the best way to only work with the first x number of elements in an
> array?
>
> At the moment this script prints the entire contents of @lines for each
> element in @cfgs
>
> I would like to restrict this to the number of elemen
On Fri, 2006-05-26 at 09:45 +1000, Keenan, Greg John (Greg)** CTR **
wrote:
> --start--
> use strict;
> use warnings;
>
> my $cfgDir = '/amanda/admin/etc/amanda';
> my @cfgs = qw(Toaster MFG-UNIX SYS-UNIX Amanda-Daily);
> my %numTapes = (
> "$cfgs[0]" => 6,
> "$cfgs[1]" => 5,
> "$cfgs[2]"
Hi,
What is the best way to only work with the first x number of elements in an
array?
At the moment this script prints the entire contents of @lines for each
element in @cfgs
I would like to restrict this to the number of elements listed in the hash
%numTapes for each element in @cfgs
Any