#!/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 ); #### #!/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 the 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;