RE: Calling functions using variable (I mean symbolic refs)

From: Kamal Gupta (kamal.gupta_at_wipro.com)
Date: 11/26/04


Date: Fri, 26 Nov 2004 13:08:31 +0530
To: <kamal.gupta@wipro.com>, <beginners@perl.org>


Some one please do help me....

I'm sure that there could be better solution and I'm sure that someone
would have faced a similar situation.

Do let me know your best possible solution for this scenario.

>Subject: Calling functions using variable (I mean symbolic refs)
>
>
>
>Hi all,
>
>
>May be this is a OLD topic of discussion.
>
>
>I have a Perl script with lot of functions. This Perl script
>accepts two
>command line options (string values) where the concatenation of these
>two strings will give me the function name.
>
>
>All the functions in this Perl script are like this.
>
>
>For eg.,
>
>
>#!/usr/bin/perl
>
>
>use strict;
>
>
>use Getopt::Long;
>
>my $rc = GetOptions( "class|c=s"
> ,"method|m=s"
> ,"help|h|?"
> ,"trace:i"
> );
>...
>..
>..
>...
>{
>no strict 'refs';
>my $functionname = $options{class}."_".$options{method};
>
>
>&$functionname;
>}
>
>
>sub Class1_Method1 {
>
>
>print "Class 1 Method1\n";
>
>
>}
>
>
>sub Class1_Method2 {
>
>
>print "Class 1 Method2\n";
>
>
>}
>
>
>sub Class2_Method1 {
>
>
>print "Class 2 Method1\n";
>
>
>}
>
>
>My question now is in many docs that I have read they say that it is
>always better to avoid symbolic references. Is there any better way of
>implementing the above mentioned scenario, If so do suggest
>and explain.
>
>
>With Best regards,
>R. Kamal Raj Guptha.
>Ph: 91-80-28411990 Ext:1296
>Mobile - 9880351218
>
>
>
>
>
>
>Confidentiality Notice
>
>
>The information contained in this electronic message and any
>attachments to this message are intended
>for the exclusive use of the addressee(s) and may contain
>confidential or privileged information. If
>you are not the intended recipient, please notify the sender
>at Wipro or Mailadmin@wipro.com immediately
>and destroy all copies of this message and any attachments.
>

Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.



Relevant Pages

  • AW: need a good 32-bit ata/100 raid
    ... Important Confidentiality And Limited Liability Notice ... If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the email or any attachment is prohibited. ... The recipient should check this email and any attachments for the presence of viruses. ...
    (freebsd-questions)
  • RE: how to append test to file
    ... how to append test to file ... The information contained in this electronic message and any attachments ... Confidentiality Notice ...
    (perl.beginners)
  • RE: Calling functions using variable (I mean symbolic refs)
    ... Hey Paul, ... >> I have a Perl script with lot of functions. ... The information contained in this electronic message and any attachments to this message are intended ... you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately ...
    (perl.beginners)
  • Move folder from one pc to another pc...
    ... I have develop a perl script that transfer a data that we want, from one machine to another machine..... ... This e-mail and any attachments may contain confidential and ... privileged information. ... If you are not the intended recipient, ...
    (perl.beginners)
  • problem with strings
    ... I have a problem with string passed as an argument to a perl script. ... argument to the cmdtemplate option. ... The information contained in this electronic message and any attachments to this message are intended ... you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately ...
    (perl.beginners)