hi all
I have the following problem.
I'm trying to read the a file in line by line. using a for each statment,
but I want to modify each line as it come in so that I can add the file
name that I am looking in to the line.
eg. looing in file1.txt we have the line "hello world"
I want to do the following:
hello world
becomes......
file1.txt hello world
I'm tyring the following below, but to no avail
41 my $testData;
42 my $DataVariable;
43 my $combinedLogFile;
44 # Open the file for reading.
45 foreach $datafile2 (@listofFiles) {
46
47 my $data_file = "test/$datafile2";
48
49
50 open (DATA, "$data_file") or die "can't open $data_file $!";
51
52 #change made here, changing data and adding datafile
53 $DataVariable=<DATA>;
54 $combinedLogFile= "$datafile2 $DataVariable";
55 ## End of change
56 push (@array_of_data, $combinedLogFile);
57 close (DATA);
58
Thanks in advance
Pat