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 [EMAIL PROTECTED] 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 [EMAIL
PROTECTED] immediately
and destroy all copies of this message and any attachments.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>