in reply to Re: printing a string from an sql field that contains a variable
in thread printing a string from an sql field that contains a variable

Thanks.

String::Interpolate::RE looks like the most simple of those options. I have installed it, but it isn't working as I would expect, which is along the lines of:

Basically, with this module installed and available for my scripts to call upon the "strinterp" function mentioned on the cpan page:

$str = strinterp( $template );

Where $template is the string I pulled from my database and $str becomes the new string with the variables ($me, $friend, etc) replaced by their current values in the script.

If so... great, that would be a tidy solution.

Unfortunately, this just gives the error:

"Undefined subroutine &main::strinterp called at C:\Users\rest of path\"

What should I do next? (Thanks in advance, any help is appreciated).

  • Comment on Re^2: printing a string from an sql field that contains a variable
  • Download Code

Replies are listed 'Best First'.
Re^3: printing a string from an sql field that contains a variable
by ~~David~~ (Hermit) on Jun 28, 2011 at 14:21 UTC
    Do you have this line at the start of your code?

    use String::Interpolate::RE qw( strinterp );
    ~~David~~

      I do now... thanks :)

      Unfortunately, this has not changed the output I am getting, it still just prints out $me , $friend, etc.

      Do I need to make a hash named "%var" and put all the scalars in there as keys and values, then update that hash every time I update the scalar?

        Unfortunately, this has not changed the output I am getting,...

        Did you even look at the doumentation?