in reply to Re: Extracting lines starting with a pattern from an array
in thread Extracting lines starting with a pattern from an array

Thanks for the code, thanks all. But something really weird is happening... The script is returning only a single match (and I know for sure there should be more than one). I have tried a few other codes and they give me the same unique match as well.

However I have written a dummy data set and the code works on it. So, knowing that my data have been given to me by someone and they are derived from an excel file, am I right to suspect that some kind of invisible characters are causing a problem?

  • Comment on Re^2: Extracting lines starting with a pattern from an array

Replies are listed 'Best First'.
Re^3: Extracting lines starting with a pattern from an array
by u65 (Chaplain) on Dec 18, 2015 at 11:37 UTC

    If you suspect that, you might try looking at the raw input data. For example, on *nix start with this

     $ od -cx input-data.txt > raw-input-data.txt

    and look at the output file.

      As an added bonus, od is part of the PerlPowerTools suite so you don't even have to rely on it being supplied as a binary by your O/S.