Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: FMTYEWTK about split //

by Roger (Parson)
on Jan 21, 2004 at 14:25 UTC ( [id://322891]=note: print w/replies, xml ) Need Help??


in reply to Re: FMTYEWTK about split //
in thread FMTYEWTK about split //

you can't do this with split, can you?

Sure can.
for (split //, $string) { print "$_\n"; }

Replies are listed 'Best First'.
Re: Re: Re: FMTYEWTK about split //
by ambrus (Abbot) on Jan 21, 2004 at 14:41 UTC
    I thought that for (split //, $string) { would cost a lot of memory if $string is long, but now I'm not sure.

      It will cost a lot of memory. Fortunately, $string is rarely large. And if it is large, the regex-iterator solution will probably be slow. You'll probably be better off with a substr solution on large strings.

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      : () { :|:& };:

      Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://322891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found