All I'm looking to do is simplify the creation of several scripts which will use the same bit of code. I've read through the section in Programming Perl for creating my own modules and have what I think is a functioning module.
package dates_email; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw($startDate, $endDate, $searchStart, $searchEnd); our @EXPORT_OK = qw($emailTo, $emailFrom, $emailBcc); our %EXPORT_TAGS = { dates => [qw($startDate, $endDate, $searchStart, $searchEnd)], emails => [qw($emailTo, $emailFrom, $emailBcc)], }; # Declare our global variables my (@days, @months, @years, @searchDate); my $time = time(); sub setDates { for (1 .. 7) { $time -= 24*60*60; my @date = (localtime($time))[3 .. 5]; push @days, (sprintf '%02d', $date[0]); push @months,(sprintf '%02d',$date[1] + 1); push @years, $date[2] + 1900; push @searchDate, join "-", ($date[2] + 1900), (sprintf '%02d',$date[1] + 1), (sprintf '%02d', $date[0]); } } sub startDate { $startDate = join "-", $months[$#months], $days[$#days], $years[$#years]; } sub endDate { $endDate = join "-", $months[0], $days[0], $years[0]; } sub searchStart { $searchStart = join "-", $years[$#years], $months[$#months], $days[$#days]; } sub searchEnd { $searchEnd = join "-", $years[0], $months[0], $days[0]; } sub emails { $emailTo = "[EMAIL PROTECTED]"; $emailFrom = "RT"; $emailBcc = "[EMAIL PROTECTED]"; } exit; Is this all it should look like? I'll import it with "use dates_emails ("dates", "emails");". However, I'm not sure how to actually use the variables imported. Do I call them the same thing in my script or do I have to use a different variable? All this homemade module stuff is new to me so I need help sorting through it. Thanks Mathew -- Keep up with me and what I'm up to: http://theillien.blogspot.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/