Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

(Whups... forgot to log-in.)

One thing that might really throw you for a loop is, when you define a sub, “where are the parameters?!” Perl has the very peculiar strategy of placing all of the arguments to a function into an array (strangely-named “@_”) which is available to the function, and you'll see people grabbing parameters off of it with things like shift (which pops the first element from an array).

However, I must say that I do admire a language that makes it a trivial task to reverse two variables that are out-of-order:   (This is a list assignment...)

($a, $b) = ($b, $a) if ($b > $a);
... and it is very nice to work in a system that has a very well-thought-out notion of “lists” and “hashes,” even though the language bumbles through some of these concepts with (in my opinion) rather sickening syntax. (Hold your nose when you get to “contexts.”)

And let's face it:   Messrs. Kernighan and Plauger put an assortment of “warts” into their language too, and by now we sort-of don't see them as warts anymore because we like what the language lets us do. The same's true of Perl. (It's a “teletype-era language” too, and sometimes it shows.) You'll scratch your head a lot, stick your tongue out at it a few times, roll your eyes and mutter under your breath, and in a matter of a few days or maybe a week or so, begin to get the groove of what all the fuss is about. Quite a few more “warts” here to be overlooked, but love is blind. ;-)

In reply to Re: help with perl understanding by sundialsvc4
in thread help with perl understanding by barryscott

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2021-06-13 15:14 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (57 votes). Check out past polls.