[H-GEN] A perl query

Three Blokes gerbil at bigpond.net.au
Mon May 5 04:46:54 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Jason Parker-Burlingham <jasonp at uq.net.au> wrote:
>                 s/$regex/$subs{$1}/g;

One more clarification if you don't mind and then I will understand it all.
In the above line, how does this expression know which value from %keys to
substitute for the $regex that it's matched?, I'm assuming the {$1} is it,
but what I want explained is how the compiler realises that $1 means the
value that currently matches from $regex?, is that just a standard (so in
every case where a match is found $1 will hold the value that was matched?

Thanks again guys for all your help, and sorry to be a nuisance.

   Joe


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list