PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below,

I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.

I need the output inside an ARRAY
How can this be done.

Any help will be appreciated. Thanks in advance.

Try this...

#!/usr/bin/perl

@values = ("2011_11_05", "2011_11_04" , "2011_11_03");
my $filename = 'abc_yyyy_mm_dd';
my $datevar ='yyyy_mm_dd';
if ($filename =~ $datevar)
{
        $val=substr($filename,0,index($filename,$datevar));
        foreach (@values){
                push(@file_date,$val.$_);       
        } 
}

foreach $v (@file_date){
        print $v,"\n";
}

--ahamed

Thanks ahamed.

The below one works fine too for the same.