Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Process string as Array

by Somni (Friar)
on May 29, 2004 at 15:29 UTC ( [id://357483]=note: print w/replies, xml ) Need Help??


in reply to Re: Process string as Array
in thread Process string as Array

Recent changes to unpack (added in 5.8.0) have made splitting a string into groups much easier.

$string = "foo" x 3 . "fo"; print join(" -- ", unpack "(A3)*", $string), "\n";

Though your code is slightly different; the final "fo" is tacked onto the end of the last element, whereas with the above it's a new element.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found