saranperl has asked for the wisdom of the Perl Monks concerning the following question:
The above code. i got result 1 . Then ,if i change$s="boys are playing"; @a=$s=~/\w/; foreach(@a){ print $_."\n"; }
i will get 1 is answer. Then ,if i change@a=$s=~/\w+/
i will get b is answer. Then ,if i change@a=$s=~/(\w)/
i will get boys is answer. why answer is 1 without bracket ? why answer is b with bracket? please help me@a=$s=~/(\w+)/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex word return
by ig (Vicar) on Aug 27, 2009 at 05:49 UTC | |
|
Re: regex word return
by jwkrahn (Abbot) on Aug 27, 2009 at 05:37 UTC | |
|
Re: regex word return
by ikegami (Patriarch) on Aug 27, 2009 at 06:51 UTC | |
|
Re: regex word return
by bichonfrise74 (Vicar) on Aug 27, 2009 at 05:40 UTC |