Re: Two-liner to one-liner

2004-01-30 Thread Jan Eden
R. Joseph Newton wrote: R. Joseph Newton wrote: Oooops, sorry, needs a small adjustment, I think: Jan Eden wrote: BTW, accessing $1 like this implies that $1, $2 ... form an array. How can it be accessed as a whole? my @matches =( /($regex)/g); Ok, that should have been obvious. Thank you.

Re: Two-liner to one-liner

2004-01-30 Thread John W. Krahn
Jan Eden wrote: R. Joseph Newton wrote: R. Joseph Newton wrote: Oooops, sorry, needs a small adjustment, I think: Jan Eden wrote: BTW, accessing $1 like this implies that $1, $2 ... form an array. How can it be accessed as a whole? my @matches =( /($regex)/g); Ok, that should

RE: Two-liner to one-liner

2004-01-29 Thread Jan Eden
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

RE: Two-liner to one-liner

2004-01-29 Thread Jan Eden
there is 1 element in the list. If there were more parentheses it might return a higher number. -Original Message- From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 6:13 PM To: 'Jan Eden'; 'Perl Lists' Subject: RE: Two-liner to one-liner I think

Re: Two-liner to one-liner

2004-01-29 Thread Jeff 'japhy' Pinyan
On Jan 27, Jan Eden said: my($teilnehmer) = $eingabe =~ m/(?=Teilnehmer:\n\n)(.+)/s; As far as I can tell, there is no need for a look-behind in this regex. my ($teilnehmer) = $eingabe =~ /Teilnehmer:\n\n(.+)/s; should be sufficient. my(@teilzeilen) = split /\n/, $teilnehmer; As for

Re: Two-liner to one-liner

2004-01-29 Thread R. Joseph Newton
Jan Eden wrote: BTW, accessing $1 like this implies that $1, $2 ... form an array. How can it be accessed as a whole? my @matches = /($regex)/g; my @matches = /hard-coded random stuff(.*) boilerplate(.*)more unwanted (.*)/; Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Two-liner to one-liner

2004-01-29 Thread R. Joseph Newton
R. Joseph Newton wrote: Oooops, sorry, needs a small adjustment, I think: Jan Eden wrote: BTW, accessing $1 like this implies that $1, $2 ... form an array. How can it be accessed as a whole? my @matches =( /($regex)/g); my @matches = (/hard-coded random stuff(.*) boilerplate(.*)more

Re: Two-liner to one-liner

2004-01-28 Thread John W. Krahn
Jan Eden wrote: Hi all, Hello, 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; This does not work: my @teilnehmer = $eingabe =~ m/(?=Teilnehmer:\n\n)(.+)/s;

RE: Two-liner to one-liner

2004-01-28 Thread Charles K. Clarkson
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? How about:

RE: Two-liner to one-liner

2004-01-28 Thread Tim Johnson
Eden'; 'Perl Lists' Subject: RE: Two-liner to one-liner 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. -- To unsubscribe, e-mail: [EMAIL