in reply to Re: simple regex question
in thread simple regex question (parsing and saving a file)

Thanks mull, this is almost what i want but i also need to assign the whole match to an array at the same time.

Replies are listed 'Best First'.
Re: Re: Re: simple regex question
by pike (Monk) on Oct 23, 2001 at 16:39 UTC
    No problem, just push every line you want to save to an array:

    if (/Datasource:/) { print "\n\n", $_, "\n"; push @log, $_; }
    Modify all if-Blocks like this. BTW, since you append a '\n' to every line you print, there is no need to chomp it off first.

    pike