Re: use: command not found error
by jettero (Monsignor) on May 03, 2007 at 20:07 UTC
|
You're running that as a .bat batch file or a .sh shell script, use a #!/she/bang or fix your file associations. That or run perl filename.pl.
Correct. Perl rocks. Rock on dude.
| [reply] |
|
Monks, thanks! ok that was stupid on my part:
yes indeed perl (space) script_name.pl works.
You guys are correct; the only reason it is line 18 is because of the fact that there are a whole bunch of comments before the start of the script:
#!/usr/bin/perl -w
18 use strict;
19 use Date::Calc qw(Add_Delta_Days);
Thanks a bunch Monks!
| [reply] |
|
Just a tip: when you quote some code, put it in beetween
<code> tags. It is more readable.
Max
| [reply] [d/l] |
Re: use: command not found error
by halley (Prior) on May 03, 2007 at 20:07 UTC
|
Are you sure you're running this script with the Perl interpreter? The "command not found" is something a command script interpreter (like CMD.EXE or bash) might say.
Rather than just giving us one line, and asking us to guess, show more code. It's odd that you get to line 18, but maybe you start with a lot of comments.
-- [ e d @ h a l l e y . c c ]
| [reply] |
Re: use: command not found error
by shigetsu (Hermit) on May 03, 2007 at 20:08 UTC
|
My guess at first sight of your description is that the shebang line - the line that points to the interpreter (on unixy systems most often: #!/usr/bin/perl) is either missing, wrong in its syntax, does not point to an existing Perl interpreter or has been misplaced (not as first line).
Perhaps some more code would help us to properly diagnose the problem? Be sure to enclose your code in <code></code> tags.
| [reply] [d/l] |
|
One route on unix systems for the "where is this user's perl?" is to use:
#!/usr/bin/env perl
which gets whatever the user would get by typing "perl" at the command line. There may be multiple perl versions in different locations, leading to strange behavior. If /usr/bin/env is not there, there are bigger problems. | [reply] [d/l] |
|
| [reply] [d/l] |
|
|
This post worked for me from the standpoint that my shebang line was not the first line.
Oh the details!!!
| [reply] |
Re: use: command not found error
by Krambambuli (Curate) on May 03, 2007 at 21:09 UTC
|
What about line #1 ?
If I'm right, you just have the shebang wrong, something like
#/usr/bin/perl
instead of
#!/usr/bin/perl
Sigh ;)
| [reply] |
|
I got the same problem. Later I found that the #!/usr/bin/env perl -w was not in the first line. It was like this
# comments
# comments
# comments
#!/usr/bin/env perl -w
Then I changed the above to
#!/usr/bin/env perl -w
# comments
# comments
# comments
It worked. | [reply] [d/l] [select] |