Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Perl

where is perl located on OS 10.6.8? I am learning the language and don't know where it is stored so I can use it for my tutorials. The book suggests "usr/bin/perl" but I think that's for Windows.

iMac, Mac OS X (10.6.8)

Posted on Jan 24, 2013 11:04 AM

Reply
Question marked as Best reply

Posted on Jan 24, 2013 11:52 AM

Should be in /usr/bin/perl on the Mac also.

17 replies

Jan 26, 2013 9:49 AM in response to Frank Caggiano

Thanks. Further reading got me to "which perl" to show where it was located. Now I have a problem with using a file to store the perl commands. When I type in the one-liner for "Hello, World", it works fine. When I put the same command into a file and then try to get it to execute, (chmod +x filename then perl filename) I get a long string of errors in the Terminal window:


Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 1, near "rtf1\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 1, near "ansi\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 1, near "ansicpg1252\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 1, near "cocoartf1038\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 2, near "fonttbl\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 2, near "f0\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 2, near "fswiss\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 3, near "red255\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 3, near "green255\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 4, near "margl1440\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 4, near "margr1440\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 4, near "vieww9000\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 4, near "viewh8400\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "viewkind0

\"

(Missing semicolon on previous line?)

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "pard\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx720\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx1440\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx2160\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx2880\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx3600\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx4320\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx5040\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx5760\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx6480\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx7200\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx7920\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "tx8640\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "ql\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 5, near "qnatural\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 7, near "pardirnatural


\"

(Missing semicolon on previous line?)

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 7, near "f0\"

Backslash found where operator expected at /Users/patnonadmin/Desktop/hello1.pl line 7, near "fs24 \"

(Do you need to predeclare fs24?)

syntax error at /Users/patnonadmin/Desktop/hello1.pl line 1, near "rtf1\"

syntax error at /Users/patnonadmin/Desktop/hello1.pl line 3, near "red255\"

syntax error at /Users/patnonadmin/Desktop/hello1.pl line 4, near "margl1440\"

"use" not allowed in expression at /Users/patnonadmin/Desktop/hello1.pl line 8, at end of line

"use" not allowed in expression at /Users/patnonadmin/Desktop/hello1.pl line 9, at end of line

syntax error at /Users/patnonadmin/Desktop/hello1.pl line 11, near ";}"

Execution of /Users/patnonadmin/Desktop/hello1.pl aborted due to compilation errors.


Most of this doesn't even seem to apply to my simple, two-line program! What is going on?

Jan 26, 2013 10:26 AM in response to wwplyr

Perl is similar to Java ... imcompatible even with itself (at least previous versions of itself). There s a book by O'Reilly press, "Programming Perl", with a camel on the front. I started reading "Learning Perl" with a llama on the front, and read the disclaimer that it teaches the "20% of the language you will use 80% of the time". But after reading ProgrammingPerl I believe that is dead wrong. That other 80% of the language is where the trickery lies. In short ... using LearningPerl and then trying to actually use Perl is like sending soldiers into nuclear war with a cap gun. In my humble opinion ... other may disagree.


Programming Perl is 1000 pages,but starts slow enough to learn the basic from the ground up. I *STRONGLY* recommend that book.


Now ... to versions. ProgrammingPerl (I will shorten it to PP) highlights features that do not exist "prior to Perl 5.x" (many different versions). SL (OSX 10.6.x) comes with Perl 5.10.0, which is old now. Perl 5.17 is out there (PP only covers through 5.14 though), and many of the features that are in use by companies come in versions 5.12 at least, if not 5.14 and higher.


I used this command to load "perlbrew", an environment that will add new verions of perl to your system WITHOUT deleting the system default ... and you shoud not mess with system default lest you break something. www.perlbrew.pl is the site. The command is simple ... "curl -kL http://install.perlbrew.pl | bash" (between the ".pl" and "bash" is the "vertical bar" symbol, or you can just cut&paste).

Jan 26, 2013 10:31 AM in response to steve359

Steve359: You're assuming I know what you're talking about! I've only read the first 20 pages of the book! Where would I put the "curl -kL http://install.perlbrew.pl | bash" command? I'm using the X11 Terminal supplied on my iMac.


Frank C: I still get an error: I typed "chmod +x filename" then "./filename" and got this:


-bash: ./Users/patnonadmin/Desktop/hello1.pl: No such file or directory


At least it's only one line this time! Any more suggestions? Thanks.

Jan 26, 2013 10:35 AM in response to steve359

Steve359: I tried to read Frank Wall's book "Programming PERL" and only made it halfway through the first chapter. He's way beyond what I want to know. My head was spinning and I didn't even know half of what he was saying -- just gobbley-gook to me!


I just want to know how to handle the information from my forms, not all of the philosophy and machine thinking on how it works.


It's probably a very good programming system, but I'm not really wanting to program beyond getting the info as I indicated.

Jan 26, 2013 10:37 AM in response to wwplyr

(Don;t worry I'vebeen doing this for a long time I didn't understand it either 😝)


Frank C: I still get an error: I typed "chmod +x filename" then "./filename" and got this:



Was filename above hello1.pl as below?

-bash: ./Users/patnonadmin/Desktop/hello1.pl: No such file or directory


At least it's only one line this time! Any more suggestions? Thanks.

You need to post the script.

Jan 26, 2013 10:48 AM in response to wwplyr

I have programmmed in Fortran and C and Java and C# and C++ and Perl. All languages have quirks. Sometimes are incompatible with previous version of themselves. Java and Perl are worst for this, in my experience, of that set. C and C++ does not change much over time (C will always be simple, C++ will always be bloated).


When you do not understand the pitfalls you will have issues.


One example is that a variable name can be used for an array and for a hash and for a scalar. You can have "$list" and "@list" and "%list". And the two assignment statements "@list = ("one", "two", "three");" and "$list = ("one", "two", "three");" have different results. Perl allows many combinations you can randomly/accidentally type but will have silently-incorrect results.


The "curl" command is to load perlbrew onto your system allowing you to make any version you want of Perl active, allowing 5.10, 5.12, 5.14, 6.16 and5.17 to all be available to you when/if you want them.


Good luck to you.

Jan 26, 2013 12:29 PM in response to wwplyr

TextEdit will work if you go into preferences and turn on plain text mode.


But as etresoft wrote you'll be much happier if you plan on doing this long term with a more programmer friendly editor.


TextWrangler is really very good for a range of system functions and is free,


Learning an editor like vi is a good move also as it will almost always be available on any Unix like system you are on. Of course if you really want to play with the big boys you'll need to learn ed 😎

Jan 26, 2013 1:01 PM in response to Frank Caggiano

Okay, I downloaded TextWrangler and re-did the file under its auspices. Here's the error message:


Can't locate warning.pm in @INC (@INC contains: /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at /Users/patnonadmin/Desktop/hello2.pl line 3.

BEGIN failed--compilation aborted at /Users/patnonadmin/Desktop/hello2.pl line 3.


Ugh! This is getting very frustrating!

Perl

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.