Re: regular expression - ?(foo.*)?

2010-03-02 Thread Durairaj Muthusamy
Thanks very much for clearing my doubts. Regards, Durai On Tue, Mar 2, 2010 at 7:44 PM, Johann Markl wrote: > Hello > > Durairaj Muthusamy wrote: >>  I am a newbie and need your help. The following script doesn't >> display the first print statement li

regular expression - ?(foo.*)?

2010-03-02 Thread Durairaj Muthusamy
Hi, I am a newbie and need your help. The following script doesn't display the first print statement like the second one. Why? @str = qw(NEW food foosball newstr foobasefoot); $\ = "\n"; foreach(@str) { print "First: $&" if ?(foo.*)?; print "Second: $&" if /(foo.*)/; } Output