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.
Expand|Select|Wrap|Line Numbers
- 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;
- }
Expand|Select|Wrap|Line Numbers
- $str will have = prstat-Ls-20080118-1800.xls value.
Expand|Select|Wrap|Line Numbers
- $str = prstat-Ls-LAVG-20080118-1800.xls
Expand|Select|Wrap|Line Numbers
- $str = substr($f,32,39);
- $str1 = substr($str,0,9);
- $str = "LAVG".$str;
- $loadavg ="c:\\Performance_svap\\OUTPUT_FILES\\$str";
any help or suggestions will great full for me.
Thanks,
Vijayarl