[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] STRING2LIST conversion



luca.post@nettuno.it writes:
>Is there a function to load a @list with string's characters as elements:
>
>                @list= func("anystring");
>
>returns $list[0]="a", .... $list[9]="g" ???

Try @list = split(//, "anystring");

>I read getc must be avoided (SLOW!) ...

I would be very surprised if split were not significantly slower than getc.
If you really need character-at-a time processing, use getc.

Matthias

-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html
  "Diamler-Benz reported that it will lose $4.2 billion in 1995. Billion. I 
   wonder if the press and analysts will tell people not to buy a Mercedes."
                                             -- Guy Kawasaki