|
|
| Perl: the Markov chain saw | |
| PerlMonks |
Re: chopping lots of charactersby Abigail-II (Bishop) |
| on Jun 24, 2004 at 11:45 UTC ( #369294=note: print w/ replies, xml ) | Need Help?? |
|
As you said, substr is the way to go. chop chops off one character, and not more than one. So, if you want to chop off 4 characters using chop, you need to chop 4 times. Either by duplicating the line, or by using a loop. You might want to bail out if the string is empty: Or although the latter might want to chop an empty string (but only once). Abigail
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||