in reply to Re: /g matches not really global in scalar context!
in thread /g matches not really global in scalar context!
Huh?!?
I think you misunderstood me! I do use very often the /g modifier in list context:
ormy $n =()= / \b aiutino \b /gix; warn "Argh, $n times";
warn "$_ => Argh!\n" for / \b aiutino \b /gix; # Ok: not that interesting with a fixed lenght string!
Update: in the code above I did s/smart/interesting/, as per Aristotle's remark: indeed the latter adjective better reflects my feeling - I meant that $_ saves me some typing but will always have the value 'aiutino', and it would be more interesting with a more complex regex. Well, thinking of it better, not quite always 'aiutino', because I used /i, but still there ought to be more interesting cases...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: /g matches not really global in scalar context!
by Aristotle (Chancellor) on Nov 14, 2005 at 22:17 UTC |