Perl 'Expert' Quiz-of-the-Week #1
Mark-Jason Dominus <[email protected]> Wed, 16 Oct 2002 14:51:12 -0400
| Newsgroups | gmane.comp.lang.perl.qotw.quiz-of-the-week |
|---|---|
| Organization | Plover Systems |
| Message-ID | <[email protected]> |
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.
For example, if $1, $2, and $3 happen to be "dogs", "fish" and
"carrots", then
subst("$2, $1 and $3")
should return
"fish, dogs, and carrots"
----------------------------------------------------------------
Some notes:
* I'll post an example solution here on Monday.
* perl-qotw will only carry the quizzes and solutions. Discussion,
remarks, comments, and soforth should go to
[email protected]. To subscribe to that list, send mail
to [email protected].
* I'd like to request that nobody post any sample solutions or other
spoilers to the discussion list until at least Saturday.
* Even after Saturday, any solutions or other spoilers should always
be marked with the word SPOILER in the subject line, so that other
people won't see them by accident.
* If you'd like to contribute a quiz question, send it to me.
* I will set up a web archive eventually. In the meantime, old
messages are always available by email. Send a message to
[email protected] (or to
[email protected]) for instructions.
Thanks.