When I am running the following statement:
@filtered = map {s/ //g} @outdata;
it is returning an empty list instead of the filtered list that I expected. What I am trying to do is remove every occurrence of from an array of string (which is an XML file).
Obviously, I am not understanding something. Can anyone tell me the correct way to do this might be, and why this isn’t working for me as is?
Try this:
The problem is the s operator in perl modifies $_ but actually returns the number of changes it made. So, the extra $_ at the end causes perl to return the modified string for each element of @outdata.