Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

use DateTime gives error

by pgmer6809 (Sexton)
on Mar 20, 2021 at 05:01 UTC ( #11129993=perlquestion: print w/replies, xml ) Need Help??

pgmer6809 has asked for the wisdom of the Perl Monks concerning the following question:

This simple code
#/usr/bin/perl # use DateTime; print "DateTime Loaded\n"; exit 77 ;
Works if I run:  perl tst_useDT.pl But if I just type:   ./tst_use_DT.pl I get an error:

./tst_use_DT.pl: line 3: use: command not found

Error: no such file "DateTime Loaded\n"

What could be wrong? I did install DateTime twice; once using sudo to /usr/local and once to my own home directory. Could that be the reason? If so how would I delete the module from my homedirectory? thanks, pgmer6809

Replies are listed 'Best First'.
Re: use DateTime gives error
by haukex (Archbishop) on Mar 20, 2021 at 05:33 UTC

    You're missing an exclamation mark in the very first line, after #. Update: That's causing the shell to think it's a shell script instead of a perl script, and the first error message you're seeing is actually from the shell trying to run a program called use.

      I'm an idiot. It came to me as I was on the verge of sleep last night. I was hoping I could delete this before anyone noticed. :(! Thanks for the help. pgmer6809

        No worries, it happens to everyone :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11129993]
Approved by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-11-30 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?