Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thank you very much, that explained a lot to me. I get it now. @others: Yes, I am at the beginning of my PERL journey, and I thank everyone who posted.

Lesson #1: it's not PERL, but either Perl or perl. See also PERL as shibboleth and the Perl community. However, to expand on the answers you got thus far: yes, $_ and @_ are special variables, described along with all the other special vars in perldoc perlvar. While it is true that the former is the default scalar variable in the sense that many constructs default to it, I wouldn't go so far as to say that the latter is the "default array": in fact it is much a technical device for parameter passing in subs, which in Perl 5 is in fact both extremely simple and has far reaching consequences. In Perl 6 by contrast @_ will still be there but thanks to the much more complex and powerful mechanism for parameter passing, you won't need most of the time. Back to 5, you can still use @_ as a generic array, but as someone said, this kind things smells. One situation in which you may want to assign to @_ is when you want to use magic goto (BTW: don't you ever use non-magic one), but that is an advanced topic that I would postpone to a much later lesson.

In your OP you also write "I also do not quite understand how to work a hash." Well, this is a very basic Perl topic covered in the first few chapters or pages of any introductory book or tutorial. So I'm not even trying to explain to you how to work with a hash in Perl in any detail, because for sure there are lots of people already doing that far better than I ever could. I'll just tell you what a hash is: a mapping from some finite set (of strings) into some other (also finite, for obvious reasons) set, implemented in such a way that lookup is generally quite fast (but generally you don't care at all).


In reply to Re^3: Not quite understanding a couple of things by blazar
in thread Not quite understanding a couple of things by pikablu

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-18 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found