WearyTraveler has asked for the wisdom of the Perl Monks concerning the following question:
I loaded strawberry perl on my Win 7 machine. Things are going pretty good, but I would like to create a subs.pm file that can store all the little subroutines that I am writing / using.
They work fine when inside the program, but when I try to call the subs.pm, perl cant find them.
Directory structure: C:\strawberry\perl\bin\test.pl C:\strawberry\perl\subs.pm
Subs.pm snippet:
sub remove_spaces { my ($input, $junk) = @_ ; $input =~ s/\s+/ /g ; $input =~ s/^ //g ; $input =~ s/ $//g ; chomp($input) ; return $input ; }
Script snippet:
#!C:\strawberry\perl\bin\perl.exe #use lib 'C:\strawberry\perl'; #use subs ; $line = remove_spaces($line);
Results in:
C:\strawberry\perl>test.pl Undefined subroutine &main::remove_spaces called at C:\strawberry\perl +\test.pl line 18, <INF> line 1.
How do I refer to the subroutine in the pm file?
Thank you in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strawberry perl and subroutines - subs.pm
by Corion (Patriarch) on Dec 09, 2010 at 23:16 UTC | |
|
Re: strawberry perl and subroutines - subs.pm
by jethro (Monsignor) on Dec 10, 2010 at 00:59 UTC | |
|
Re: strawberry perl and subroutines - subs.pm
by 7stud (Deacon) on Dec 10, 2010 at 01:41 UTC | |
by Anonymous Monk on Dec 20, 2010 at 20:28 UTC | |
|
Re: strawberry perl and subroutines - subs.pm
by WearyTraveler (Novice) on Dec 20, 2010 at 19:43 UTC |