$sql = 'select * from EMP where EMPNO=&eno and DEPTNO=&dno and JOB=&job'; my @fields; if (my($where) = $sql =~ /\swhere\s+(.*)/i) { @fields = map /(\S*)=&/, split /\sand\s/i, $where; }