#!/usr/bin/perl use strict; use warnings; my $inv = batch_inventory->new(); my @ranges; for (my $c = 1; $c < 9; $c+= 3) { my $range = page_range->new(); $range->{vol} = $c; $range->{start_pg} = $c+1; $range->{end_pg} = $c+2; push (@ranges,$range); } $inv->{ranges} = @ranges; foreach my $range ($inv->{ranges}) { print "$range->{vol} $range->{start_pg} $range->{end_pg}\n"; } exit (0); ########## Objects ########## package page_range; sub new { my $class = shift; my $self = { vol => undef, start_pg => undef, end_pg => undef }; bless $self, $class; return $self; } package batch_inventory; sub new { my $class = shift; my $self = { ranges => undef, gaps => undef }; bless $self, $class; return $self; }