Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Counting characters in a string

by ysth (Canon)
on Feb 06, 2004 at 16:02 UTC ( #327110=note: print w/ replies, xml ) Need Help??


in reply to Re: Counting characters in a string
in thread Counting characters in a string

That will stop at every newline and continue again after it:

$ perl -we'$string = "abcdef\nghijk\nlmno\npqr\nst\nu"; > print map { "$_\n" } $string =~ /.{1,5}/g;' abcde f ghijk lmno pqr st u
You either want the //s flag on the match or some other way of dealing with newlines.


Comment on Re: Re: Counting characters in a string
Download Code
Re: Re: Re: Counting characters in a string
by valentin (Abbot) on Feb 06, 2004 at 16:15 UTC
    thanks, you are right //s is fine for me.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-08-29 04:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls