Hi Everyone,
i need to add a string in between the filename.so that new file will have the
required filename.
what am doing is reading the files from the directory & extract only the filename and then pass this failename to create new file.
now what i need is instead of just passing filename, i need to add some string to this filename & then pass the filename to create a new file.
-
sub loadavg_file(){
-
my $dir = 'C:\Performance_svap\INPUT_FILES\*.xls';
-
my @file=glob("$dir");
-
my @output;
-
my $loadavg;
-
my $str;
-
my $str1;
-
my @data;
-
my $date;
-
foreach my $f (@file){
-
$str = substr($f,32,39);
-
$str1 = substr($str,0,9);
-
$loadavg ="c:\\Performance_svap\\OUTPUT_FILES\\$str";
-
-
blaah blaah...
-
....
-
....
-
}
-
open(EX,">$loadavg") or die "Can't open open $loadavg:$!";
-
print EX "$output[0]\t$output[1]\t$output[2]\t$output[3]\t$output[4]\n";
-
close EX;
-
}
-
so, in the above script, $str variable holds the filename. now to this variable i need to append the required string in between ie,
-
$str will have = prstat-Ls-20080118-1800.xls value.
-
now i need to append the string to this variable & it should look like
-
$str = prstat-Ls-LAVG-20080118-1800.xls
-
i tried changing with first instance ie,
-
$str = substr($f,32,39);
-
$str1 = substr($str,0,9);
-
$str = "LAVG".$str;
-
$loadavg ="c:\\Performance_svap\\OUTPUT_FILES\\$str";
-
am not getting how append the string in between the file name.
any help or suggestions will great full for me.
Thanks,
Vijayarl