When I type "chmod a+x my_program" (no $ sign) am I supposed to get some response?

No. That chmod call sets a bit in your file's directory entry that marks it as executable by all users. That way, when you type ./my_program, the system knows it can execute your script. There's usually no response.

If you're curious, you can type man chmod; that will explain the various bits that can be set to allow reading, writing, and executing the file for the owner, his group, or all users.

One more question: I'm supposed to start every new script with: #!usr/bin/perl right? I've double-checked already and made sure Perl is in that directory!

Correct! The '#!' tells the system that you're about to tell it what program to use to run the file.

You could add a -w to that line if you want to run your program with warnings enabled. The "canonical" way to start a script is:

#!/usr/bin/perl -w use strict;
use strict turns on additional features like errors for undeclared variables.

If you're using a more recent perl, you could replace the -w with "use warnings;", but I think that can wait until you get through your first perl book.

Good luck!
--
Mike


In reply to Re: Re: Using Perl on OS X by RMGir
in thread Using Perl on OS X by 1st_try

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.