three more ways i forgot to add. there is no shame or anything wrong with
first putting the value of a method or sub call into a scalar and
interpolating that.

        my $val = $foo->method() ;
        my $out = "text${val}more text" ;

since you can interpolate hash values, a simple templater can be done
this way:

        my %vals = ( FOO => $foo->method(), BAR => $bar->other_method ) ;
        my $out = "text$vals{FOO}more text$vals{BAR}" ;

and the old way of using . is still fine even if i don't like it:

        my $out = "text" . $foo->method() . "more text" ;

i just hate using . by itself. hard to read and rarely needed. note that
i use .= a ton of times which is not the same. :)

so that is 6 ways to do it without eval and tied. :)

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to