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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.