in reply to Split lines in file to columns

But value for colD is not captured correctly, as string in colD has sapces in between.
my ($colA, $colB, $colC,$colD) = split( /\s+/, $line, 4);
If value for $colB = XYZ and $colD contains substring = Region , I need to replace the $colB from XYX to N/A.

There are many ways to do this. What did you try? How did it fail?

Replies are listed 'Best First'.
Re^2: Split lines in file to columns
by Magnolia25 (Sexton) on Mar 20, 2019 at 09:50 UTC

    Thanks hippo that worked

    If value for $colB = XYZ and $colD contains substring = Region , I need to replace the $colB from XYX to N/A

    Now I am going to try this out , was stuck at that part. So gave the reason why I am looking for this solution for earlier part