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!
In reply to strawberry perl and subroutines - subs.pm by WearyTraveler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |