in reply to Use of Uninitialized value in substitution (s///)
Well done kyle! I should have realised that [ and ] were being interpreted as link metacharacters.
There are a number of odd things about this script. I'll start with a couple of minor points, The code and comments in these lines are contradictory
Actually replaces all groups of non word characters with a single space.$status =~ s/(\W+)/ /gs; #Eliminate all non-word characters followed b +y space.
Replaces first group of non-word characters with a single space.$soc =~ s/(\W+)/ /; #Eliminate all non-word characters followed by spa +ce.
Replaces first group of non-digit characters with a single space.$subscriber =~ s/(\D+)/ /; #Eliminate all non-digits followed by space +.
The more egregious error is the logic is badly flawed. This nested loop
should be written asforeach (@file_row) { while ( $line < $#file_row + 1 ) { $row_data = $file_row[$line]; # Processing goes here. $line++; } #while } #foreach
Unless @file_row was used elsewhere I would eliminate reading the entire file and do it a line at a time like soforeach $row_data ( @file_row ) { # Processing goes here. }
Actually I doubt that we were given the irreducible minimum to reproduce the problem so I think @file_row is only used here and should be eliminated.while ( $row_data = <IN_FL> ) { # Processing here }
Update: I'd also change
toopen(IN_FL, $input_FL) || die ("unable to open directory");
You are not opening a directory and it will help debugging if you print the reason you can't open the file.open IN_FL, $input_FL or die "unable to open $input_FL:$!";
|
|---|