in reply to Splitting Data

Use a regular pattern match:

@thingies = m/\[\d+\]\s*=\s*\d+/g;

Replies are listed 'Best First'.
Re: Re: Splitting Data
by flounder99 (Friar) on Dec 08, 2003 at 20:39 UTC
    This is a good candidate for a one liner.
    $ cat temp.txt | perl -ne 'print "$_\n" for /\[\d+\]\s*=\s*\d+/g' [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 1 [11] = 2 [12] = 3 [13] = 4 [14] = 5 [15] = 6 [16] = 7 [17] = 8 [18] = 9 [19] = 10

    --

    flounder

        but but but, I think it's cleaner / nicer / not that much of a waste / my privelege to waste processes!

        --

        flounder