Perl: the Markov chain saw | |
PerlMonks |
Re: FMTYEWTK about split //by ambrus (Abbot) |
on Jan 21, 2004 at 13:21 UTC ( [id://322866]=note: print w/replies, xml ) | Need Help?? |
I always used ()=$string=~/(.)/gs; to split a string to characters. Also, it's sometimes useful to iterate through the characters of a list, for which you can use the scalar-context variation: while($string=~/(.)/gs){DO SOMETHING WITH ($1)}; -- you can't do this with split, can you? Update: added s flags, strange noone noticed that
In Section
Meditations
|
|