in reply to Re: Trouble usig a subroutine from a custom module
in thread Trouble usig a subroutine from a custom module
Choroba, thanks for your reply. I implemented your suggestions and will add the code here for trouble shooting purposes, but I am still getting this error:
Undefined subroutine &VSCOperl::trim called at ./dupCheck.pl line 19, <DATA> line 960.
Here is the new code to my program:
#!/home/myhomedrive/opt/perl/bin/perl use strict; use warnings; use Data::Dumper; use Net::LDAP; use lib '/home/myhomedrive/scripts/lib'; use customPerlMod qw{ trim ltrim rtrim }; my $string = " ll "; $string = customPerlMod::trim ( $string );
and here is the Module:
#!/home/myhomedrive/opt/perl/bin/perl package customPerlMod; use strict; use warnings; use Exporter 'import'; our @EXPORT_OK = qw(return_month return_day trim ltrim rtrim ); # Perl trim function to remove whitespace from the start and end of th +e string sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } # Left trim function to remove leading whitespace sub ltrim($) { my $string = shift; $string =~ s/^\s+//; return $string; } # Right trim function to remove trailing whitespace sub rtrim($) { my $string = shift; $string =~ s/\s+$//; return $string; } 1;
what do you mean by prototypes?
Thanks in advance for your help!
Frank
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Trouble usig a subroutine from a custom module
by choroba (Cardinal) on Nov 11, 2024 at 16:23 UTC | |
by fritz1968 (Sexton) on Nov 11, 2024 at 21:34 UTC |