in reply to Problems with Net::IRC
Wonko#--------------------------------------------------------------------- +--------- =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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problems with Net::IRC
by boilera (Initiate) on Feb 17, 2003 at 22:14 UTC |