Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Interpolation 0.71

    Download button

    No screenshots available
    Downloads: 355  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jenda Krynicky | More programs
    Perl Artistic License / FREE
    September 12th, 2007, 22:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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: 7

    Of 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



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    string interpolation | arbitrary string | Perl module | string | interpolation | semantics

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM