develooper Front page | perl.beginners | Postings from September 2003

building module/package

Thread Next
From:
perl
Date:
September 29, 2003 19:03
Subject:
building module/package
Message ID:
2718.66.93.71.122.1064887494.squirrel@webmail.swanmail.com
Can someone help with build a simple module with one function in it?
Can't seem to get anythign working.

I guess something like:

test.pl
-------
use mystuff;

print mystuff::trim($username);

mystuff.pm
----------
#do i need any declaration line here
#is sub here or what?
#and where do i put this pm file?

sub trim
{ my $z = $_[0];
  $z =~ s/^\s+//;
  $z =~ s/\s+$//;
  return $z;
}

thanks,
-rkl

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About