Literal split:
#!/usr/bin/perl use warnings; use strict; my $_ = join ' ', 1..30; say "Split at 11th whitespace:"; say " <$_>" for split /(?:\s+\S+){10}\K\s+/, $_, 2; say "Split every 11th whitespace:"; say " <$_>" for split /(?:\s+\S+){10}\K\s+/; __END__ Split at 11th whitespace: <1 2 3 4 5 6 7 8 9 10 11> <12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30> Split every 11th whitespace: <1 2 3 4 5 6 7 8 9 10 11> <12 13 14 15 16 17 18 19 20 21 22> <23 24 25 26 27 28 29 30>
In reply to Re: Split String after nth occurrence of a charater
by Anonymous Monk
in thread Split String after nth occurrence of a charater
by Amiru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |