in reply to recursive call of current script

It depends.

AFAIS you are not using next at the end of each block, so there is no explicit fall-through

so one way is

for ( $sFunction ) { /test1/ || /test2/ and do { # .... }; /test2/ and do { # will be executed too }; }

another way is to use a subroutine

my $do_test1 = sub { #... }; for ( $sFunction ) { /test1/ && $do_test1->(); /test2/ && do { $do_test1->(); # will be executed too }; }

On a side note: why don't you use if or even if-elsif-else constructs?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: recursive call of current script
by feumw (Sexton) on Jun 21, 2022 at 11:51 UTC
    I didn't wrote the script originally, so I can't say why they did it this way. I'm gonna try both versions to see if this does the trick for us. But yeah using subroutines would already help. Didn't thought about that, colleague just asked me for ideas. Right now there's not enough time for us to rewrite this script. This would be a good workaround for us.