On Thu, Aug 01, 2002 at 06:02:14PM -0400, Miko O'Sullivan wrote: > It would be really groovy if that expression could be split with the > delimiters in place, something like this: > > @tokens = split _/[?=*-+]/, $sql, keep=>'all'; > > and get back an array with these values: ('rank', '=', '?') > > But that raises a problem: what if the expression is this (note the spaces): > > rank = ? > > In that case I would want the = and ? but I wouldn't want the spaces. A > slightly different option could keep just stuff in parens: > > @tokens = split _/\s*([?=*-+])\s*/, $sql, keep=>'parens';
But perl5 already does this: $ perl -le 'print join "|", split /\s*([?=*-+])\s*/, "rank = ?"' rank|=||? $ Dave. -- You live and learn (although usually you just live).