Amphiaraus has asked for the wisdom of the Perl Monks concerning the following question:

I have the CPAN Modules Inline::Files and Inline::Awk, and am using Strawberry Perl 5.18.1001. I copied the simplest of the sample programs from the Inline::Awk page and attempted to run it:
#!C:\strawberry\perl\bin\perl.exe use strict; use warnings; use Inline:: Files; use Inline::AWK; awk(); __END__ __AWK__ BEGIN { print "Hello, world!" }
++++++++++++++++++++++++++++++++++++++++++++++++++

However I get the error message:
Undefined subroutine &main::awk called at test_awk.pl

+++++++++++++++++++++++++++++++++++++++++++++++++

I looked for "Undefined subroutine" threads in Perl Monks and tried some of the alternate syntax suggestions, however I get the same error after trying each of these:
a) Change "awk" function call line to -- Inline::AWK::awk();
b) Change "use" line to -- use Inline::AWK qw(awk);

++++++++++++++++++++++++++++++++++++++++++++++++++

The strawberry folder holding the Awk.pm file is: C:\strawberry\perl\site\lib\Inline
Is it possible that Inline::Awk works with regular Perl, but Inline::Awk fails when using Strawberry Perl?

++++++++++++++++++++++++++++++++++++++++++++++++++

My version of Strawberry Perl (5.18.1001) has a2p.pod but lacks a2p.exe.

When I removed "use strict" and "use warnings", and used "use Inline AWK;", I get the error message:

" 'a2p' is not recognized as an internal or external command, operable program or batch file."

(Removal of "use strict" is necessary, otherwise when including "use Inline AWK;" AWK is called a "bareword" and the program fails.)

Is it the case that the only remedy is to find some later version of Strawberry Perl that re-introduces a2p.exe? I can find no CPAN module that might be used to re-introduce a2p.

The Inline AWK CPAN module assumes that a2p is available.

Replies are listed 'Best First'.
Re: Undefined subroutine error when using CPAN module Inline::AWK
by choroba (Cardinal) on May 13, 2016 at 21:38 UTC
    The documentation of Inline::Awk suggests yet different syntax:
    use Inline AWK; # ^ # | # Space. awk(); # operates on @ARGV by default __END__ __AWK__ ...

    a2p that implements the functionality should still be present in your version of Perl, but note that it was removed from core in 5.22 (but see App::a2p).

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,