Write a subroutine, 'subst', which gets a string argument, $s. It should search $s and replace any occurrences of "$1" with the current value of $1, any occurrences of "$2" with the current value of $2, and so on.dominus' post-mordem analysis of this problem can be found here. He offers several solutions and some discussion of why (and why not) to use them.For example, if $1, $2, and $3 happen to be "dogs", "fish" and "carrots", then
should returnsubst('$2, $1 and $3')"fish, dogs, and carrots"
In reply to Re: Re: $1 in variable regex replacement string
by jsprat
in thread $1 in variable regex replacement string
by dvergin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |