in reply to Re: Re: recursive join
in thread recursive join

Firstly, you don't need to reference $_ for the m// or the s///, as it is the default. Second, you can capture the bit you want in the m//. It's also better to use a different delimiter if you have /'s in your regex

push @array, $1 if m[^FOO\s=\s(.*?)/$];
should capture everything after the first space after the '=' and before the trailing '/'. If the number of spaces might vary then

push @array, $1 if m[^FOO\s+=\s+(.*?)/$];

This wouldn't harm if there is only one space before and after.


Examine what is said, not who speaks.

Replies are listed 'Best First'.
Re: Re: Re: Re: recursive join
by Anonymous Monk on Dec 21, 2002 at 15:04 UTC
    Thanks again, you have been a great help. I always learn something new when I come here.

    One last thing, shouldn't I have a slash after the match character?

    push @conf, $1 if m[^SSLOGGER FILE\s+=\s+(.*?)/$]; #before push @conf, $1 if m/[^SSLOGGER FILE\s+=\s+(.*?)/$]; #after
    I'm using VIM for windows and it doesn't like that string for some reason

      No. I was using m[...] as an alternative to m/.../

      If your editor doesn't like it, then try m!...!


      Examine what is said, not who speaks.