in reply to SOLVED:use -d -t -s as script args

To evaluate Perl code, you need to pass it to perl, or use eval EXPR or require or do.

eval EXPR is what you want here.

Replies are listed 'Best First'.
Re^2: use -d -t -s as script args
by vincentaxhe (Scribe) on Jun 21, 2024 at 19:35 UTC
    I figure it out
    my $code = "sub is_wanted { " . join(" and ", @ARGV) . " } "; unless (eval $code.1) { die "Error in code: $@\n\t$code\n"; } $_ = $filepath; if (is_wanted()){ push @matched, $filepath; }
      um, do it safely, don't use @ARGV directly