in reply to Re^3: If Exists in an Array?
in thread If Exists in an Array?

Assuming that your example pertains to this:
($RR_Name,$Loco_no,$Event_Date,$Event_Time,$Event_Code,$Event_Duration +,$Source_File)=split(/,/,$record);

You're currently splitting on just the comma, so the spaces are retained. To lose the lead/trail spaces just change your split:

($RR_Name,$Loco_no,$Event_Date,$Event_Time,$Event_Code,$Event_Duration +,$Source_File)=split(/[ ,]+/,$record); # + ^ ^^