Re: New Perl Quiz of the Week mailing list perl-qotw
[email protected] (Eugene van der Pijll)
| Newsgroups | perl.golf |
|---|---|
| Message-ID | <[email protected]> |
En op 21 oktober 2002 sprak Gareth McCaughan:
> I'm feeling very dim. What's wrong with the much simpler
>
> sub subst { (my $a=shift) =~ s/\$\d+/eval$&/eg; $a; }
You have to replace '$1' by the actual value of $1. If you try that with
a regex, $1 is changed. In your case, $1 (and $2, $3 etc.) is
undefined.
(-ugene
--
As programmers, we're not supposed to be trying to find the shortest
solution. We're trying to find the *best* solution.
-- /\\ark-_|ason |)ominus