Article 3605 of comp.lang.perl:
Xref: feenix.metronet.com comp.lang.perl:3605
Newsgroups: comp.lang.perl
Path: feenix.metronet.com!news.ecn.bgu.edu!wupost!cs.utexas.edu!uunet!ulowell!ulowell.ulowell.edu!sfrazier
From: sfrazier@cs.ulowell.edu (Scott Frazier)
Subject: Library Difficulties
Message-ID: <SFRAZIER.93Jun21153736@cs.ulowell.edu>
Sender: usenet@ulowell.ulowell.edu (News manager - ulowell)
Organization: The Naughty Peahen Party Line
Distribution: comp
Date: Mon, 21 Jun 1993 20:37:36 GMT
Lines: 56


Hi,

	I'm trying to pull functions out of perl code and throw them into
a library.  Unfortunately, I've never been able to successfully do this
even though I've read what the Camel book has to say on the subject.
If anyone could tell me what's wrong with this, I'd really appreciate it.
Both files were in the same directory.  It looks like the perl
interpreter is trying to execute the subroutine as a command, IE: "sh:
sub: not found" or something similar.

**** Driver  ***

#!/usr/local/bin/perl

unshift(@INC,'.');

require `genDate.pl`;

$date = &genDate;
print "Gendate returned $date\n";

**** genDate.pl ***

sub genDate
{
    %months = (
	       'Jan', '01',
	       'Feb', '02',
	       'Mar', '03',
	       'Apr', '04',
	       'May', '05',
	       'Jun', '06',
	       'Jul', '07',
	       'Aug', '08',
	       'Sep', '09',
	       'Oct', '10',
	       'Nov', '11',
	       'Dec', '12',);
    chop($date=`date`);
    $date =~ /(\w+) (\w+) (\w+) (\w+:\w+:\w+) (\w+) (\w+)/;
    $_ = join('/', $months{$2}, $3, substr($6,2,2));
}

1;



						Thanks in advance,
								-Scott

--

Scott W. Frazier                                sfrazier@cs.ulowell.edu
Systems Office, x3636				sfrazier@dragon.cpe.ulowell.edu



Article 3622 of comp.lang.perl:
Xref: feenix.metronet.com comp.lang.perl:3622
Newsgroups: comp.lang.perl
Path: feenix.metronet.com!news.utdallas.edu!corpgate!bnr.co.uk!uknet!pipex!uunet!cs.utexas.edu!usc!howland.reston.ans.net!agate!netsys!pagesat!news.cerf.net!netlabs!lwall
From: lwall@netlabs.com (Larry Wall)
Subject: Re: Library Difficulties
Message-ID: <1993Jun22.172034.8626@netlabs.com>
Sender: news@netlabs.com
Nntp-Posting-Host: scalpel.netlabs.com
Organization: NetLabs, Inc.
References: <SFRAZIER.93Jun21153736@cs.ulowell.edu>
Distribution: comp
Date: Tue, 22 Jun 1993 17:20:34 GMT
Lines: 6

In article <SFRAZIER.93Jun21153736@cs.ulowell.edu> sfrazier@cs.ulowell.edu (Scott Frazier) writes:
: require `genDate.pl`;

Change those to forward quotes and it should work much better.

Larry


