<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://community.activestate.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>ActiveState Community Site - method invocation syntax at perl - Comments</title>
 <link>http://community.activestate.com/forum-topic/method-invocation-syntax-perl</link>
 <description>Comments for &quot;method invocation syntax at perl&quot;</description>
 <language>en</language>
<item>
 <title>solved</title>
 <link>http://community.activestate.com/forum-topic/method-invocation-syntax-perl#comment-3767</link>
 <description>&lt;p&gt;it will be &lt;/p&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;print $l-&amp;gt;${\($str.$str1)}($str2);&lt;/pre&gt;</description>
 <pubDate>Thu, 03 Jan 2008 05:27:26 -0800</pubDate>
 <dc:creator>subghost</dc:creator>
 <guid isPermaLink="false">comment 3767 at http://community.activestate.com</guid>
</item>
<item>
 <title>method invocation syntax at perl</title>
 <link>http://community.activestate.com/forum-topic/method-invocation-syntax-perl</link>
 <description>&lt;p&gt;Hello&lt;br /&gt;
I&#039;ve got a little problem with method invocation. here is a code:&lt;/p&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;my $l = new z;

$l-&amp;gt;{xxx4} = &#039;wrong way&#039;;

my $str = &#039;xxx&#039;;
my $str1 = &quot;4&quot;;
my $str2 = &quot;param1&quot;;

eval (&quot;print \$l-&amp;gt;$str$str1(\$str2)&quot;);

package z;

sub new
   {
   my $class = shift;
   my $self = {};
   return bless $self, $class;
   };

sub xxx4
   {
   my $self = shift;
   my $param = shift;
   return &quot;were requested xxx4: $param \n&quot;;
   };&lt;/pre&gt;&lt;p&gt;
It&#039;s just an example to show the problem. &lt;/p&gt;
&lt;p&gt;The point is: &lt;/p&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;eval (&quot;print \$l-&amp;gt;$str$str1(\$str2)&quot;);&lt;/pre&gt;&lt;p&gt;I want make same actions without using eval.&lt;br /&gt;
At perlobj there is an example:&lt;/p&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;$method = $fast ? &quot;findfirst&quot; : &quot;findbest&quot;;
$fred-&amp;gt;$method(@args);          # call by name&lt;/pre&gt;&lt;p&gt;so for my case it will be something like &lt;/p&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;my $method = $str.$str1;
print $l-&amp;gt;$method($str2);&lt;/pre&gt;&lt;p&gt;
the question is: can it be done at single string?&lt;br /&gt;
Thank you.&lt;/p&gt;
</description>
 <comments>http://community.activestate.com/forum-topic/method-invocation-syntax-perl#comments</comments>
 <category domain="http://community.activestate.com/forums/perl-discussion-0">Perl discussion</category>
 <category domain="http://community.activestate.com/os/all-any">All / Any</category>
 <pubDate>Thu, 03 Jan 2008 01:54:42 -0800</pubDate>
 <dc:creator>subghost</dc:creator>
 <guid isPermaLink="false">1769 at http://community.activestate.com</guid>
</item>
</channel>
</rss>
