Perl : Search for next occurence of a word in an array

I have an array as follows:

Space: ABC
Name: def
Age: 22
Type: new
Name: fgh
Age: 34
Type: old
Space: XYZ
Name: pqr
Age: 44
Type: new
:
:

How can I separate the array with elements starting from Space:ABC until Space: XYZ & put them in a different array & so on...

Something like this:

$ cat test.pl
#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;

my $i=-1;
my @array;

while(my $line=<DATA>){
        chomp $line;
        $i++ if $line=~/^Space/;
        push @{$array[$i]},$line;
}

print Dumper(\@array);

__DATA__
Space: ABC
Name: def
Age: 22
Type: new
Name: fgh
Age: 34
Type: old
Space: XYZ
Name: pqr
Age: 44
Type: new
$ perl test.pl
$VAR1 = [
          [
            'Space: ABC',
            'Name: def',
            'Age: 22',
            'Type: new',
            'Name: fgh',
            'Age: 34',
            'Type: old'
          ],
          [
            'Space: XYZ',
            'Name: pqr',
            'Age: 44',
            'Type: new'
          ]
        ];

To get line one of element 1, use $array[0][0], for line 3 of element 2 use $arary[1][2], ...

Thanks Pludi for the quick reply.

One thing I forgot to mention earlier is that the Data which I posted is from an array & is not definite. I think there might be some changes need to be done then. Can u pl help me understand on how can I achieve this ?

What do you mean by that? The code above will work as long as each section starts with 'Space' at the beginning of a line.

Or do you mean that you've already got the data in an array? In that case, just replace

while(my $line=<DATA>){

with

foreach my $line(@yourarray){

Thanks pludi, it seems to be working... will I b able to use @array as a normal array for further processing ??
Just for my understanding can u explain me the use of Dumper which is being used in this code (m pretty new to perl).