On Thu, Aug 03, 2000 at 05:57:45PM +0100, Hildo Biersma wrote:
>    'AMQ9506' => [ "Channel '($channel_patt)' has ended because",
>                   "Channel" ],
> 
>    'AMQ9508' => [ "The connection attempt to queue manager '(.*?)'
> failed with reason code ($reason_patt)\\.",
>                   "QMgr", "Reason" ],
> 
>    'AMQ9509' => [ "The attempt to open either the queue or queue manager
> object '(.*?)' on queue manager '($qmgr_patt)' failed with reason code
> ($reason_patt)\\.",
>                   "Object", "QMgr", "Reason" ],
> 
>    'AMQ9510' => [ "The attempt to get messages from queue
> '($qname_patt)' on queue manager '($qmgr_patt)' failed with reason code
> ($reason_patt)\\.",
>                   "QName", "QMgr", "Reason" ],
> 
> Now, I run every message by the description, and then I need to store
> $1, $2, $3, etc into the "appropriate" object field.  If you want to do
> this without hard-coding for $1, $2, $3, $4 etc and without doing an
> eval, you need symbolic references - the part of the foreach() loop that
> does this contains "no strict 'refs'".
> 
> If you want to do this in a B&D fashion, you will end up with
> $match_result->ExtractPattern(1) for $1, which is pretty nasty.

It doesn't have to be as "nasty" as a method call, simply store your results
in an array:

    (@matches) = ($string =~ /regex/)

Now, reference the elements of @matches as you would do your symbolic
lookups.  strict refs again, yay!


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to