Re: how to get two matches out

2012-05-03 Thread Paul Johnson
On Sun, Apr 29, 2012 at 11:10:33AM -0500, Lawrence Statton wrote: From perlretut, I quote: In list context, //g returns a list of matched groupings, or if there are no groupings, a list of matches to the whole regexp. So if we wanted just the words, we could use

Re: how to get two matches out

2012-04-30 Thread Shawn H Corey
On 12-04-29 10:12 PM, lina wrote: P.S seems we don't have the same perldoc. Try this one: http://perldoc.perl.org/ -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. [updated for today's programmers] Show

how to get two matches out

2012-04-29 Thread lina
Hi, I have a text file like: $ more sample.tex aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3} bbb\cite{inhibitor}aaa sub read_tex{ open my $fh, '', @_; while($fh){ if(/cite\{(.+?)\}/){ push @citeditems,split/,/,$1; }

Re: how to get two matches out

2012-04-29 Thread Lawrence Statton
On 04/29/2012 10:21 AM, lina wrote: Hi, I have a text file like: $ more sample.tex aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3} bbb\cite{inhibitor}aaa sub read_tex{ open my $fh, '', @_; while($fh){ if(/cite\{(.+?)\}/){ push

Re: how to get two matches out

2012-04-29 Thread lina
On Sun, Apr 29, 2012 at 11:26 PM, Lawrence Statton lawre...@cluon.com wrote: On 04/29/2012 10:21 AM, lina wrote: Hi, I have a text file like: $ more sample.tex aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3} bbb\cite{inhibitor}aaa sub read_tex{        open my $fh, '', @_;        

Re: how to get two matches out

2012-04-29 Thread Shawn H Corey
On 12-04-29 11:41 AM, lina wrote: if($_ =~ m/cite\{(.+?)\}/g){ Not work. while( $_ =~ m/cite\{(.+?)\}/g ){ -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. [updated for today's programmers] Show me your

Re: how to get two matches out

2012-04-29 Thread Lawrence Statton
On 04/29/2012 10:41 AM, lina wrote: On Sun, Apr 29, 2012 at 11:26 PM, Lawrence Stattonlawre...@cluon.com wrote: On 04/29/2012 10:21 AM, lina wrote: Hi, I have a text file like: $ more sample.tex aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3} bbb\cite{inhibitor}aaa sub read_tex{

Re: how to get two matches out

2012-04-29 Thread lina
Thanks for Lawrence's crystal clear explaination and Shawn's reply. I understand now, best regards, P.S seems we don't have the same perldoc. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/