Interpolation

Interpolation is an arbitrary string interpolation semantics (using tie()).
Download

Interpolation Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jenda Krynicky
  • Publisher web site:
  • http://search.cpan.org/~jenda/Interpolation-0.71/Interpolation.pm

Interpolation Tags


Interpolation Description

Interpolation is an arbitrary string interpolation semantics (using tie()). Interpolation is an arbitrary string interpolation semantics (using tie()).SYNOPSIS use Interpolation name => &function, ...; print "la la la la $name{blah blah blah}"; # This is like doing: $VAR = &function(blah blah blah); print "la la la la $VAR";Beginners always want to write this: print "The sum of three and four is: 3+4";And they want the 3+4 part to be evaluated, so that it prints this: The sum of three and four is: 7Of course, it's a double-quoted string, so it's not evaluated. The only things that are evaluated in double-quoted strings are variable references.There are solutions to this, but most of them are ugly. This module is less ugly. Well .... this module IS ugly, but only inside. Your code may end up being nice.The module also lets you define arbitrary interpolation semantics.For example, you can say use Interpolation money => &commify_with_dollar_sign, E => 'eval', placename => 'ucwords', ;And then you can write these: print "3 + 4 = $E{3+4}"; # Prints ``3 + 4 = 7'' $SALARY = 57500; print "The salary is $money{$SALARY}"; # Prints ``The salary is $57,500.00'' $PLACE1 = 'SAN BERNADINO HIGH SCHOOL'; $PLACE2 = 'n.y. state'; print "$placename{$PLACE1} is not near $placename{$PLACE2}"; # Prints ``San Bernadino High School is not near N.Y. State";Requirements:· Perl Requirements: · Perl


Interpolation Related Software