in reply to Problems with Net::IRC

A small utility routine that I like to use to do this, sinice the need arises so often. Good way to avoid some of the security risks inherent to using eval. Gives you the control of exactly 'what' is allowed to be interpreted.
#--------------------------------------------------------------------- +--------- =pod =head2 interpolate( scalar, href ) Purpose : To interpolate an href of vars into a string. Usage : my $template = q{$name was also know as $alias.}; my $variables = { '$name' => 'Bob', '$alias' => 'Big Bad Bob', }; interpolate( $template, $variables ); =cut #--------------------------------------------------------------------- +--------- sub interpolate { my ( $text, $variables ) = @_; $text =~ s/$_/$variables->{$_}/g for ( keys %$variables ); return $text; }

Wonko

Replies are listed 'Best First'.
Re: Re: Problems with Net::IRC
by boilera (Initiate) on Feb 17, 2003 at 22:14 UTC

    10x guys

    You are GREAT !!!