in reply to Capturing Multiple lined data with regex.

The best thing would be to set $/ to some kind of record separator such that your my @unclean = <LST> actually sucks in one record per array entry rather than one line ($/ is the input record separator, usually "\n", so <LST> reads in a line at a time). However, without more information it's difficult to tell what a good value would be.

It looks as if every record is separated by a line consisting of "N/A N/A\n"; if that's true, then try setting $/ = "N/A N/A\n" ("\nN/A N/A\n" might be safer — matches a line containing exactly N/A N/A, not simply ending in N/A N/A) and taking a look at what you get in @unclean (more info in perlvar docs). If that works then you might also want to investigate using /s and/or /m as modifiers on your regexp (these modify how regexps process newlines - more info in perlop docs).

HTH…

Replies are listed 'Best First'.
Re^2: Capturing Multiple lined data with regex.
by blackadder (Hermit) on Dec 08, 2004 at 21:50 UTC
    It all came flooding back to me! All them hours of studying! Reading this and this.

    Many thanks indeed
    Blackadder