Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Not quite understanding a couple of things

by pikablu (Initiate)
on May 25, 2007 at 01:51 UTC ( #617375=note: print w/replies, xml ) Need Help??


in reply to Re: Not quite understanding a couple of things
in thread Not quite understanding a couple of things

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.
  • Comment on Re^2: Not quite understanding a couple of things

Replies are listed 'Best First'.
Re^3: Not quite understanding a couple of things
by blazar (Canon) on May 25, 2007 at 08:28 UTC
    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).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://617375]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2022-01-28 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (73 votes). Check out past polls.

    Notices?