Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: zsh/pcre module docs



On Jul 3, 12:51pm, Clint Adams wrote:
} Subject: PATCH: zsh/pcre module docs
}
} This describes the behavior introduced by 15228.
} Perhaps there should be a switch to disable
} the clobbering of pparams, though I don't believe
} perl has a similar feature.

Wouldn't it have been better to put these in the $match array (or into
some other named array) the way that backrefs in glob patterns do?

$1 etc. in Perl are not positional parameters -- you don't lose access
to @ARGV when you do a pattern match.  I think clobbering the positionals
is more harmful than helpful; if you want to be able to reference $1 etc.
you can always do

	pcre_match ...
	set - "$match[@]"	# or whatever it is named

For comlete generality, pcre_match could take the name of the array to set
as an argument; then the above could be accomplished with

	pcre_match -a argv ...

(where I've chosen -A somewhat arbitrarily, and another character might be
better).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author