$option::just_print( ) gives errors, so I did this : my $a = "&"."$adaption"."::just_print()"; eval $a; Is their any better way to do this(apart from our great OO) ?(consider that the two packages have 10-15 functions having similar names,so executing it in the above way is not a good way) I guess, you guys have already answered this..but just for clarification sake#!/usr/local/bin/perl use standard; use nonstandard; my $option = "standard"; my_print("i m in main\n"); $option::just_print(); <-- error :syntax error at main.pl near "$opt +ion::just_print(" sub my_print(){ print @_; } package nonstandard; sub just_print{ print "in just_print nonstandard \n"; main::my_print("calling my_print from nonstandard\n"); } 1; package standard; sub just_print{ print "in just_print standard \n"; main::my_print("calling my_print from standard\n"); } 1;
In reply to Re: •Re: calling functions with same names but in different modules depending on user input
by Anonymous Monk
in thread calling functions with same names but in different modules depending on user input
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |