in reply to Interpolating inside Net::DNS

rr_add is the name of a function, right? And you're putting a different function name in $var1? This isn't a simple case of interpolation, because it modifies the flow of your program.

That's not to say you can't do it, of course. You can either use eval, as in:

$var1=rr_add $update->push(update => eval "${var1}('foo.example.com. 86400 A 192.16 +8.1.2'))");
or else you can use a symbolic reference:
no strict 'refs'; $var1=rr_add $update->push(update => $var1->('foo.example.com. 86400 A 192.168.1.2' +))");

Both of these code snippets are untested, but they should get you pointed in the right direction.

Replies are listed 'Best First'.
Re: Re: Interpolating inside Net::DNS
by Roghue (Initiate) on May 11, 2004 at 19:52 UTC
    You were right, it worked like a charm with the symbolic reference.
    I never had the need to go further than using the ${} when interpolating in my scripts... untill now :)
    Thnx for that.
    bye,
    Roghue