add lines in file with perl

How to search string like: a[7:0] and replace to
a[0]
a[1]
a[2]
:
:
a[7]
in a file with perl?

Thanks,
Grace

perl -pi.bak -e 's/^(.)\[(\d):\d\]/$1[$2]/' file

It doesn't work for me. I try to use perl script to handle each line in file. The code I used:
open(OF, $infile);
while ($line = <OF>)
{
my $w = "(.+?)";
$line =~ m/^$w\[$w:$w\]/;
my $name = $1;
my $high = $2;
my $low = $3;
for (my $i=$low; $i<=$high; $i++)
{
$line = sprintf("%s[%d]\n",$name,$i);
}
}

That only one line be replaced: a[7:0] -> a[7], but I need add more 6 lines for a[0] ~ a[7]. How to do that with perl scripts?

#!/usr/bin/perl 
my $string = "a[7:0]";
$string =~ /\[(\d):(\d)\]/;
foreach ( $2 .. $1) {
 print "a[" . $_ . "]\n";
}

output:

# ./test.pl
a[0]
a[1]
a[2]
a[3]
a[4]
a[5]
a[6]
a[7]

It's no problem print these lines in screen, but I still can't put these lines in file. Like my code:
open(OF, $infile);
open(NF, ">$outfile");

while ($line = <OF>) {
if ( $line =~ m/\[/ )
{
my $w = "(.+?)";
$line =~ m/^$w\[$w:$w\]/;
for (my $i=$3; $i<=$2; $i++)
{
$line = sprintf $1."[".$i."]\n";
}
}
print NF $line;

The $line only show the latest value (e.g. a[7]), but can't add more 6 lines in file.
e.g. input file:
i_clk
i_Sdi
i_Csb
i_kp_d[7:0]
o_en_cmos

I want to output file as:
i_clk
i_Sdi
i_Csb
i_kp_d[0]
i_kp_d[1]
i_kp_d[2]
i_kp_d[3]
i_kp_d[4]
i_kp_d[5]
i_kp_d[6]
i_kp_d[7]
o_en_cmos

bur current result as:
i_clk
i_Sdi
i_Csb
i_kp_d[7]
o_en_cmos

I misunderstood your original requirements, this should work:

open(OF, $infile);
open(NF, ">$outfile");

while ($line = <OF>) {
   if ( $line =~ m/^(\w+)\[(\d)/ ){
      my $foo = $1;
      my $digit = $2;
      for (0..$digit){
         print NF "$foo\[$_\]\n";
      }
   }
   else {
      print NF $line;
   }
}
close OF;
close NF;

It works! Thanks so much.