How can I reuse a subroutine?
My environment is redhat 9, apache2, perl-5.8.0-88, mod_perl-1.99_07-5.
I've tried to put the sub in a separate file and call it from another as
below. Please modify the snipet below to make it work.
mycommon.pl
-----------
#!/usr/bin/perl
#return a value wrapped by single quotes
#should this be declare package something?
sub doWrap
{ my $retval;
if(length($_[0]) == 0) { $retval = "null"; }
else { $retval = "'" . $_[0] . "'"; }
}
tst.pl
------
#!/usr/bin/perl
require "mycommon.pl";
print &doWrap("hello"); #should output 'hello' with single quotes
thanks,
-rkl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]