in reply to Help perlifying this string parse-o-rama

A regexish solution:
#!/usr/bin/perl use warnings; use strict; my $string = 'firstfield second field KNOWNWORD alwaysOneWord then one + or more make the last field'; my (@fields) = $string =~ / ^ (\S+) [ ] (.*?) [ ] KNOWNWORD [ ] (\S+) +[ ] (.*) /x; for my $i (0 .. $#fields) { print "$i:$fields[$i]\n"; }

Note that it might not work if KNOWNWORD is one of the words in the second field.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ