Thanks for all the suggestions. This is a very helpful list.

Charles K. Clarkson wrote:

>Jan Eden <[EMAIL PROTECTED]> wrote:
>: 
>: I tried to stuff the following two lines into one, but did 
>: not succeed:
>: 
>: my($teilnehmer) = $eingabe =~ m/(?<=Teilnehmer:\n\n)(.+)/s;
>: my(@teilzeilen) = split /\n/, $teilnehmer;
>
>    Care to share a typical value for $eingabe with us?
>
It's just a bunch of text. The string "Teilnehmer:\n\n" appears just before the list 
of attendants (which I want to extract).

>    How about:
>
>my @teilzeilen = split /\n/, ( $eingabe =~ /(?<=Teilnehmer:\n\n)(.+)/s )[0];
>
>    I think(?) "( $eingabe =~ /(?<=Teilnehmer:\n\n)(.+)/s )[0]"
>is forcing the regex into list context. In scalar context it
>returns 1 (for success?) and split assumes scalar context of
>its second argument.
>
Ah! I knew about regex results in scalar and list context, but I took the @teilzeilen 
to define a list context, while in fact split defines the context. My fault.

BTW, accessing $1 like this implies that $1, $2 ... form an array. How can it be 
accessed as a whole?

Thanks again,

Jan
-- 
How many Microsoft engineers does it take to screw in a lightbulb? None. They just 
redefine "dark" as the new standard.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to