You either want the //s flag on the match or some other way of dealing with newlines.$ perl -we'$string = "abcdef\nghijk\nlmno\npqr\nst\nu"; > print map { "$_\n" } $string =~ /.{1,5}/g;' abcde f ghijk lmno pqr st u
In reply to Re: Re: Counting characters in a string
by ysth
in thread Counting characters in a string
by TASdvlper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |