Code:
#!/usr/bin/perl
use strict;
use warnings;

my $fh;
my $tag;
my $tag1;
 my %hash;
my @metadata_tags;
while(<DATA>){
    chomp $_;
    if(/^{(.*)}/) {
        $tag = $1;
push(@metadata_tags,$tag);
    } else {
        if($tag eq 'FILE') {
                if(defined($fh)){
                print $fh "</ROOT>";
                close($fh);
                }
#Convert Array to hash
my %hash=();
my $ctr = 1;
$hash{$ctr++}=$_ foreach (@metadata_tags);

            my $filename = $_;
            open($fh, '>', "$filename.xml") or die "$filename: $!";
            print $fh '<?xml version="1.0"?>',"\n";
            print $fh "<ROOT>\n";
            print $fh "<FILE>$filename</FILE>\n";
        } elsif(defined($fh)) {
                if($_ ne ''){    #### Remove the blnak lines
            print $fh "<$tag>$_</$tag>\n";
                }
        }
    }
}
exit(0);
__DATA__
{FILE}
sourcetag1
{NUMBER}
00000

{SOURCE}
source1
{KEYWORD}
{AUTHOR}
author1
staff1
{HEADLINE}
DISPOSABLE DECOR: THE CUTTING EDGE DULLS FAST\
STYLE AT A SPEED
USUALLY ASSOCIATED WITH WARDROBE ITEMS.

{FILE}
sourcetag2
{NUMBER}
00002
{SOURCE}
sourcenam2
{KEYWORD}
{AUTHOR}
author2
staff2
Please tell me how to write a regular expression like, to store the text to an array until it finds the string in an array

and output will be as below

Code:
<?xml version="1.0"?>
<ROOT>
<FILE>sourcetag1</FILE>
<NUMBER>00000</NUMBER>
<SOURCE>source1</SOURCE>
<AUTHOR>author1</AUTHOR>
<AUTHOR>staff1</AUTHOR>
<HEADLINE>DISPOSABLE DECOR: THE CUTTING EDGE DULLS FAST\ STYLE AT A SPEED USUALLY ASSOCIATED WITH WARDROBE ITEMS.</HEADLINE>
</ROOT>