John Deighan wrote, on Wed 7/13/2005 09:55
: We have a goto in our code. I hate it, but there
just isn't a good "switch" or "case" statement in Perl yet (I think I've heard
: that it's planned), and the following just isn't
efficient enough for us:
: if ($op = 'thisop') {
: }
: elsif ($op = 'thatop') {
: }
: There are hundreds of possible values for $op. Anyway, I don't know how many people are aware of it, but the
: if ($op = 'thisop') {
: }
: elsif ($op = 'thatop') {
: }
: There are hundreds of possible values for $op. Anyway, I don't know how many people are aware of it, but the
: destination of a "goto" can be a variable,
e.g.
:
: goto $op;
:
: thisop:
: do_this();
: thatop:
: do_that();
:
: goto $op;
:
: thisop:
: do_this();
: thatop:
: do_that();
Might I suggest a
hash of sub refs? Then you can just do
&{$my_subs{$op}};
or something like
that.
Good
luck,
Joe
==============================================================
Joseph P. Discenza, Sr. Programmer/Analyst
mailto:[EMAIL PROTECTED]
Carleton Inc. http://www.carletoninc.com
574.243.6040 ext. 300 fax: 574.243.6060
Providing Financial Solutions and Compliance for over 30 Years
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs