Perl Code Question
Ed Eddington
ed at pcr7.pcr.com
Tue Jan 11 09:28:36 CST 2000
This is bugging me. I know that this works, but don't know why. Below is an
example search/replace that swaps the first 2 terms separated by a space.
The '^' here is performing some kind of "not" or "anything but" a space in
both of the [] terms. I have used this in code, but have never found this
usage of ^ in the Perl docs. Can someone explain what this '^' is doing?
s/([^ ]*) *([^ ]*)/$2 $1/; # reverse 1st two fields
Thanks!
Ed
More information about the grand-rapids-pm-list
mailing list