in reply to subroutine concatenation

Why don't you just save them in an Array and walk through it?

Replies are listed 'Best First'.
Re^2: subroutine concatenation
by imcsk8 (Pilgrim) on Feb 09, 2005 at 21:39 UTC
    Thanks!! i just did that
    it ended up like this:
    use strict; my @codesref = undef; $codesref[0] = sub {print "SUB 1\n";}; $codesref[1] = sub {print "SUB 2\n";}; foreach my $code (@codesref){ $code->(); }
    and it worked just fine


    ignorance, the plague is everywhere
    --guttermouth

      More idiomatic and a bit less syntax:

      my @codesref; push @codesref, sub { print "SUB 1\n" }; push @codesref, sub { print "SUB 2\n" }; $_->() for @codesref;