The stupid question is the question not asked | |
PerlMonks |
Re: What is the most efficient way to split a long string (see body for details/constraints)?by shadowsong (Pilgrim) |
on Jun 19, 2019 at 15:35 UTC ( [id://11101580]=note: print w/replies, xml ) | Need Help?? |
Hi mikegold10 Maybe you can still achieve what you want with very minor changes to your existing code But, using split, although easy, leads to extra parsing (beyond the last field I need) and produces a complete array of fields which I also don't need. Really? Try using this split in this form: split /PATTERN/,EXPR,LIMITIf LIMIT is specified and positive, it represents the maximum number of fields into which the EXPR may be split; in other words, LIMIT is one greater than the maximum number of times EXPR may be split. Thus, the LIMIT value 1 means that EXPR may be split a maximum of zero times, producing a maximum of one field (namely, the entire value of EXPR). Cheers,
In Section
Seekers of Perl Wisdom
|
|