###    Richard Smith wrote:
###      "... but the previous value of $1 still seems to
###      persist."
###
###
###   Hi Richard,
###
###   In RegEx, the variables $1, $2, $3 ... might carry on
###   unwanted values from previous uses.
###   How can we erase them?
###   You can do this:

$_ = "anything";
m,(a),;
print "\n(1.) \$1: ", $1;     ##   now $1 carries "a".

###   You cannot erase the $1 variable in this way:

# $1 = "";
###   Error message:  " # Modification of a read-only value attempted."

###   But you can erase the $1 and $2 and $3 ... variables in this way:

$_ = "anything";
###   $1, $2, $3 do look for "nothing" and do find "nothing", thus
###   $1, $2, $3 are erased:
m,()()(),;
print "\n(2.) \$1: ", $1;


=Result:

(1.) $1: a
(2.) $1:

###  Regards, Detlef




Reply via email to