in reply to Re: tutelage needed
in thread tutelage needed

1- I thought the s modifier treated the string as one line. Am I reading the meaning of that wrong?

2 - oh, cool...thanks. That's one of those cases where I start writing a regex, and tweak it repeatedly until it works...but then since, by some miracle, it does work I am reluctant to tweak it further :)

3- yea - I wrote that line to see if I could knowing I might need it a little later.

4- I've seen that form before, but I'm gonna try to figure out how to implement it. I have a map statement example here in one of my books that kinda is making sense to me. I'll give it a try.

thanks!

Replies are listed 'Best First'.
Re: Re: Re: tutelage needed
by jweed (Chaplain) on Jan 01, 2004 at 03:00 UTC
    I don't see an s modifier anywhere. Am I missing something?


    Who is Kayser Söze?
    Code is (almost) always untested.
      $big_string =~ s/(\(|\))//g;

      after the tilde, before my too many parentheses
        Ah. That's the substitution operator, and it has absolutely nothing to do with how you read in the file. By the time that you call the substitution, the filehandle has already been read from. ;).

        But, incedentally, if you pass a multi-line string to s/// it will go over the newlines without pause. So I guess it does kinda "treat the string as one line."

        Anyhoo, for more slurping info check out the excellent tutorial at Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };.


        Who is Kayser Söze?
        Code is (almost) always untested.