in reply to syntactic sugar, hemlock, and other such fun

One possible option:
sub step_name1 { print "stuff\n"; } sub step_name2 { print "more stuff\n";} sub restartStep ($) { my $code = shift; # Optional: test for existance of Package::"$code" here &$code; } restartStep "step_name1"; restartStep "step_name2";

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
It's not what you know, but knowing how to find it if you don't know that's important

Replies are listed 'Best First'.
Re: Re: syntactic sugar, hemlock, and other such fun
by dragonchild (Archbishop) on Aug 30, 2001 at 17:46 UTC
    Please note that Masem's solution will NOT run under strict 'refs'. I personally consider this less-than-optimal, though it is a perfectly good solution.

    It sounds like you're trying to do some sort of dispatch table. So, just use a dispatch table.

    sub foo { print "Foo!\n"; } sub bar { print "Bar!\n"; } my %dispatch = ( foo => \&foo, bar => \&bar, ); for my $key (keys %dispatch) { print "$key ... "; &{$dispatch{$key}}; }
    This has an additional benefit of not mispelling anything.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Vote paco for President!