-
- cat of perlportable.c
- -----
- #include <EXTERN.h>
- #include <perl.h>
- #define SAY_HELLO "-e", "$string = $^X; $string =~ s/.*\\///; $newstring = $^X ; $newstring =~ s/$string//; print $newstring;"
- int main(int argc, char **argv, char **env)
- {
- PerlInterpreter *one_perl;
- char *one_args[] = { "one_perl", SAY_HELLO };
- PERL_SYS_INIT3(&argc,&argv,&env);
- one_perl = perl_alloc();
- PERL_SET_CONTEXT(one_perl);
- perl_construct(one_perl);
- perl_parse(one_perl, NULL, 3, one_args, (char **)NULL);
- perl_run(one_perl);
- perl_destruct(one_perl);
- perl_free(one_perl);
- PERL_SYS_TERM();
- }
-
-
- -----
- executing a.out
- /home/zorin-os/Downloads/perl-5.26.0/
-