How to pass hash as sub parameter?

R

Rui Maciel

Tad said:
I don't _need_ to take the time ...

....and still you believe you are in any position to post condescending messages. What does this say
about you?


Rui Maciel
 
R

Rui Maciel

J�rgen Exner said:
Why would anybody do that?

If someone happens to decide to invest his time learning Perl and, after reading some tutorials,
that person decides to learn a bit more on Perl's subs then the first thing that that person will
do is open his search engine of choice and search for a Perl sub tutorial. When someone does that
through Google, the first hit from Perl.org only pops up in the 2nd or 3rd search page, with a
dozen or so tutorials on this particular subject ranking higher than that.

Moreover, Perl.com's beginner's introduction to Perl says practically nothing about passing
arguments to subs. The only thing that it is said about this subject is:

<quote>
In the same way that Perl's built-in functions can take parameters and can return values, your
subs can, too. Whenever you call a sub, any parameters you pass to it are placed in the special
array @_.
</quote>

That says nothing about the idiosyncrasies of Perl's sub arguments and it mentions nowhere the
"parameters are passed as one single flat list of scalars" tidbit. As a consequence, if a Perl
already has a programming background then he will be left with the impression that the arguments
are passed through the special array but they do retain their type. So, for example, if someone
passed a couple of arrays to a sub then @_ would be an array of arrays, with $_[0] pointing to the
first array and $_[1] pointing to the second one.


So? Neither does oreilly.com nor pick-your-favourite-domin for that
matter None of those domains have much to do with the documentation of
Perl subroutines.

If you are really searching Google for an online tutorial for Perl then
I honestly feel sorry for you: as has been discussed in this NG many
times the vast majority of those tutorials simply stink.

Yes, they do.

If you are familiar with programming then just use the standard Perl
documentation that comes with any Perl installation. Yes, it even has
tutorials for many non-trivial areas like references, regular
expressions, etc, etc.. If the standard documentation is missing, then
someone tried to save a few MBs of storage in a very wrong place.

Ok, I'll start looking into it.


Thanks for the help,
Rui Maciel
 
R

Rui Maciel

Uri said:
and if you use google to learn programming, you must be very high!

I believe people use search engines to find and filter information. If someone stumbles on perl.org
while searching for tutorials do you actually believe it would make perl.org something which can
only be used if that person is "very high" ? Obviously not.

perl has a very solid set of docs that come with it. you don't need
google to find them.

No one needs google to find them, just like no one needs a newsgroup to learn more about it. Yet,
here you are. Why is that?

try reading them and learn about perl's subs before
you go off on rants like this.

If you don't like seeing people responding to misanthropic users who waste their time flaming
newbies then you will do far better if you complain about those idiots who do their best to drive
people away from this newsgroup.


Rui Maciel
 
R

Rui Maciel

Tad said:
Do you believe that you are doing anone any favors by
expecting us to read the documentation to you?

No one forces you to read anything. So, if you don't have anything productive to add then I suggest
you waste your time elsewhere.


Rui Maciel
 
R

Rui Maciel

Uri said:
you have not been gracious at all in asking for help nor in how you
reply to answers.

You must be confused or you haven't even bothered to follow this thread. Either way, I suggest that
you read this thread. If you happen to do so, you will notice that there were plenty of helpful
posts by helpful users who succeeded in correcting my misconception and steering me in the right
direction, and they succeeded in that by posting helpful, polite messages.

me thinks you are not going to do well in the
programming world with an attitude like that.

If you believe that the problem relies in every newbie that may post any question on basic concepts
instead in the misanthropic idiots who waste their time flaming newly-comers then it appears you are
confusing your priorities.


Rui Maciel
 
J

Jürgen Exner

Rui Maciel said:
If someone happens to decide to invest his time learning Perl and, after reading some tutorials,
that person decides to learn a bit more on Perl's subs then the first thing that that person will
do is open his search engine of choice and search for a Perl sub tutorial.

Well, although they very much wish to be Google is not the answer to all
questions. And when it comes to Perl documentation they are very much
not the answer.
Moreover, Perl.com's beginner's introduction to Perl says practically nothing about passing
arguments to subs. The only thing that it is said about this subject is:

<quote>
In the same way that Perl's built-in functions can take parameters and can return values, your
subs can, too. Whenever you call a sub, any parameters you pass to it are placed in the special
array @_.
</quote>
That says nothing about the idiosyncrasies of Perl's sub arguments and it mentions nowhere the
"parameters are passed as one single flat list of scalars" tidbit.

As has been said before, there is no need to consult any web site for
Perl information.

However you do have a valid point here. I checked 'perldoc perlintro'
and while it does mention subs briefly it omits the parameter handling
characteristics completely, too.
While I realize that for the author of an introduction it is difficult
to draw the line at the right place between too much and too little
detail in this case a bit less verbiage and a bit more detail may have
been better. Just one sentence "Arguments are passed as a single flat
list and the elements in @_ are aliased to the arguments, for details
see perldoc perlsub." would go a long way to avoid common
misunderstandings.

jue
 
R

Rui Maciel

J�rgen Exner said:
However you do have a valid point here. I checked 'perldoc perlintro'
and while it does mention subs briefly it omits the parameter handling
characteristics completely, too.
While I realize that for the author of an introduction it is difficult
to draw the line at the right place between too much and too little
detail in this case a bit less verbiage and a bit more detail may have
been better. Just one sentence "Arguments are passed as a single flat
list and the elements in @_ are aliased to the arguments, for details
see perldoc perlsub." would go a long way to avoid common
misunderstandings.

Sounds reasonable. In fact, omitting the "single flat list" reference from an introduction to Perl
does sound like a reasonable option if we consider that newbies, at least when taking their very
first Perl steps, won't go beyond passing scalar types to their subs. This only starts to become an
issue once newbies start to pass non-scalar variables to a sub.


Rui Maciel
 
R

Rui Maciel

Tad said:
You appear to be resistant to learning how to conduct yourself
on Usenet.

That's odd, as I've been a usenet user for over a decade now. Isn't it strange that I had to wait
all this time to get a useless misanthropic idiot to complain about being talked back to?

Off to perpetual invisibility with you.

As you've failed to contribute anything remotely meaningful and productive, I have this nagging
feeling no one will miss your contributions.


Rui Maciel
 
U

Uri Guttman

RM> I believe people use search engines to find and filter
RM> information. If someone stumbles on perl.org while searching for
RM> tutorials do you actually believe it would make perl.org something
RM> which can only be used if that person is "very high" ? Obviously
RM> not.

learning a language is not a general search thing. the perl community
doesn't put effort into google ranking. it is up to the learner to know
there are docs with perl, good books and to go to perl.org. simple things.

RM> No one needs google to find them, just like no one needs a
RM> newsgroup to learn more about it. Yet, here you are. Why is
RM> that?

to add to the docs. you haven't even read them it seems. the basics of
subs are all there yet you seem to know little about them.

RM> If you don't like seeing people responding to misanthropic users
RM> who waste their time flaming newbies then you will do far better
RM> if you complain about those idiots who do their best to drive
RM> people away from this newsgroup.

no, we like people who ask good questions. you haven't yet. you ranted
as much as you asked. that isn't nice. sorry, you lose.

uri
 
R

Rui Maciel

Uri Guttman wrote:

learning a language is not a general search thing.

You fail to understand the difference between "learning a language" and searching for information
regarding a very specific subject. That's the fundamental role of search engines and the reason
why search engines are the most sought-for services on the web.


RM> No one needs google to find them, just like no one needs a
RM> newsgroup to learn more about it. Yet, here you are. Why is
RM> that?

to add to the docs. you haven't even read them it seems. the basics of
subs are all there yet you seem to know little about them.

Oddly enough, the very first document I read on perl was perl.com's beginner's introduction to
Perl, which fails to mention such a fundamental aspect of Perl. So, if you happen to lurk this
newsgroup to maintain that sort of info in perl.com then I have to say you have a lot of room to
improve your contributions.

no, we like people who ask good questions. you haven't yet. you ranted
as much as you asked. that isn't nice. sorry, you lose.

It's odd that you try to speak for others, as I've got plenty of helpful, constructive
contributions from friendly users, which outnumbered the misanthropic trolls which tried to piss
on this thread. So, as you are unable to post in a civilized manner then I suggest that you limit
your participation on this newsgroup to digging for information to paste on the docs. You don't
do anyone any good, let alone the Perl community, if you waste your time trolling newbies with
condescending posts.


Rui Maciel
 
R

Rui Maciel

Sherm said:
And yet, in all that time you *still* haven't learned the correct line
width at which to wrap your posts?

You mean that old relic of the 80s when people insisted on the 76-character column so that they
could read a post on a Teletype? If you happen to use a Teletype to follow this NG then I offer you
my sincere sympathy for causing you so much grief. If not, maybe I should welcome you to the 90s,
where people managed to develop UIs which supported text fields that can easily wrap text.

You *still* haven't learned to
lurk a while first and read a group's FAQ & guidelines before posting
to it?

This must be a zen thing, I guess. After all, how can you know how long a user has been lurking if,
as you suggested, he doesn't post any messages? You don't think things through, do you?

Not the brightest bulb in the box, are ya?

For wasting my time replying to vacuous dunces who believe they do anyone any favours by trolling
newbies through useless, condescending messages? You got me there, I guess.


Rui Maciel
 
U

Uri Guttman

RM> You fail to understand the difference between "learning a
RM> language" and searching for information regarding a very specific
RM> subject. That's the fundamental role of search engines and the
RM> reason why search engines are the most sought-for services on the
RM> web.

you fail in learning a language. searching the web for language stuff is
the worst way to learn. there is too much garbage out there to sift
through and google does NOT rank quality of web tutorials. too many have
links to them which ranks them higher even though they are crap. if you
google for me in the perl usenet group you will find many reviews of
perl tutorials. the vast majority of them suck python dick. they are
buggy, incomplete, poorly written, use bad perl, etc. so that is what
you think is a good thing to google. your choice.

RM> Oddly enough, the very first document I read on perl was
RM> perl.com's beginner's introduction to Perl, which fails to mention
RM> such a fundamental aspect of Perl. So, if you happen to lurk this
RM> newsgroup to maintain that sort of info in perl.com then I have to
RM> say you have a lot of room to improve your contributions.

and did you even look at perldoc perl which shows perldoc perlsub which
covers all you needed to know? learning how to use docs is a skill. so
is usenet. learn them first. you have burned many potential bridges here
already. are you proud of that. you won't be getting help from some of
the best perl hackers around. a great accomplishment in such a short
time. this is all on your head, and you have no one to blame but
yourself.

RM> It's odd that you try to speak for others, as I've got plenty of
RM> helpful, constructive contributions from friendly users, which
RM> outnumbered the misanthropic trolls which tried to piss on this
RM> thread. So, as you are unable to post in a civilized manner then
RM> I suggest that you limit your participation on this newsgroup to
RM> digging for information to paste on the docs. You don't do anyone
RM> any good, let alone the Perl community, if you waste your time
RM> trolling newbies with condescending posts.

i help tons of people here. for many years. and in other areas i
contribute to the perl community. you know not of which you speak. you
are here asking for help but you pissed off many. the culture here has
existing for decades and you expect to come in and be spoon fed your
way? that isn't how the world or usenet works. grow up.

uri
 
R

Randal L. Schwartz

Rui> You mean that old relic of the 80s when people insisted on the
Rui> 76-character column so that they could read a post on a Teletype?
Rui> If you happen to use a Teletype to follow this NG then I offer you
Rui> my sincere sympathy for causing you so much grief. If not, maybe I
Rui> should welcome you to the 90s, where people managed to develop UIs
Rui> which supported text fields that can easily wrap text.

I use GNU Emacs to read Usenet, via GNUS, which is equally adept at
reading nntp, email, or even making mailing lists appear to be
newsgroups for threading and filtering. Both GNU Emacs and GNUS are
modern, with very active development communities.

And yet, here I am, reading your post, and it annoyingly wraps, because
I have a fixed-width character buffer and it's set to 80 chars, which
happens to be a nice width to read for most people.

You, sir, are not paying attention to conventions. Why are you not
doing what *most* people wish you to do who want to read your text and
help you? It's silly to offend the very people from whom you want
assistance.

It's like we're saying "the line for help forms here, northward", and
you insist on coming along saying "but standing over here on the
southside, I get better sun!". Yeah, so what. The line forms
northward. You want help? Follow Usenet conventions.

Just another Usenet guy (from 1981, when it all started),
 
T

Ted Zlatanov

RM> Thanks for the tip, Randal. It looks promising. Nevertheless, I've
RM> never heard of Moose before, which may quite possibly be due to the
RM> fact that I'm practically just starting out. So, do you happen to
RM> know if Mosse has been widely adopted or is it an obscure feature of
RM> Perl?

Moose is a whole ecosystem of modules that overlaps a lot with Perl 6's
feature set. It is popular and has a large community. At this year's
YAPC in Columbus (YAPC is a well-known Perl conference) Moose had many
talks and interest so I think it's a good bet for the near future (3
years or so).

It's not a Perl feature. AFAIK no Moose modules are bundled with Perl.

Ted
 
K

Keith Thompson

Rui Maciel said:
You mean that old relic of the 80s when people insisted on the
76-character column so that they could read a post on a Teletype?
If you happen to use a Teletype to follow this NG then I offer
you my sincere sympathy for causing you so much grief. If not,
maybe I should welcome you to the 90s, where people managed to
develop UIs which supported text fields that can easily wrap text.
[...]

I, like many others, happen to read Usenet in a terminal emulator
with a fixed-width font and a width of 80 columns. For the vast
majority of articles I read here, that works just fine.

As for these UIs that "can easily wrap text", do you expect them
to distinguish between English text to be wrapped and Perl source
code to be left alone?

Please pause for just a moment and consider the possibility that
someone else might be right and you might be mistaken, or at
least that others might have rational reasons for their opinions
other than clinging to decades-old technology.
 
K

Keith Thompson

Tad McClellan said:
Rui mistaken? What an absurd suggestion!

Surely it must be everybody _else_ that is mistaken.

You're not helping. (Then again, I'm probably not helping either.)
 
S

Steve M.

No one forces you to read anything. So, if you don't have anything
productive to add then I suggest you waste your time elsewhere.


Rui Maciel


Probably pointless, but perhaps...

Rui,

c.l.p.m. is (IMHO) an outstanding resource for gaining understanding of
Perl.

Reading posts/responses by some of the very people you seem intent on
ignoring, if not annoying, is the main reason I frequent the site.

If you had indeed spent much time lurking you'd have noted that a poster
who is willing to listen is treated very well indeed, regardless of their
expertise and/or misconceptions.

(I shudder to think what sort of code I'd still be writing without
pointers gleaned from this group.)

It seems strange to burn the bridge *before* you cross it, but to each
his own I guess.
 
R

Randal L. Schwartz

Steve> It seems strange to burn the bridge *before* you cross it, but to each
Steve> his own I guess.

Ahh, but think of the efficiency! No need to cross *that* bridge!

:)

print "Just another Perl hacker,"; # the original
 
R

Rui Maciel

Steve said:
Probably pointless, but perhaps...

Rui,

c.l.p.m. is (IMHO) an outstanding resource for gaining understanding of
Perl.

No one is disputing that usenet newsgroups constitute invaluable sources of information. In fact,
usenet managed to become one of the best expert systems ever devised simply due to the possibility
it brings in getting answers on all kinds of topics, from those covering general aspects to corner
cases, along with the possibility of relying on archives and search engines to comb through the
backlog.

Reading posts/responses by some of the very people you seem intent on
ignoring, if not annoying, is the main reason I frequent the site.

You seem to have confused me with someone else. I haven't ignored anyone in this group, nor did I
ever stated, implicitly or explicitly, that I intended in ignoring anyone. If I did I wouldn't
have wasted my time with a hand full of misanthropic idiots whose only contribution to this thread
was trolling newbies and posting condescending messages. But if you think otherwise then be free
to point out where exactly I said something that made you believe I was ignoring anyone.

If you had indeed spent much time lurking you'd have noted that a poster
who is willing to listen is treated very well indeed, regardless of their
expertise and/or misconceptions.

If you happen to follow this thread you would realize that there were plenty of helpful users who
managed to help by posting informative messages in a civilized and polite tone, which were
fundamental in helping me understand how a basic feature of Perl operates.

Yet, there were also a hand full of misanthropic idiots who did their best to pollute this
newsgroup with insulting messages which were devoid of any value and had absolutely nothing to do
with this subject, and by doing so succeeded in injecting a lot of noise into this newsgroup.

Once you are aware of that, you can easily see that commenting on anyone's "willingness to listen"
is immaterial to this discussion, due to the fact that you are referring to the "willingness to
listen" to trolls whose only role in this discussion was to get their anti-social rocks off while
having absolutely no intention to help anyone out.



Rui Maciel
 
R

Rui Maciel

Uri said:
you fail in learning a language.

I've managed to learn C and C++, along with about half a dozen toolkits and libraries. If you
believe that this particular programming language is so unique that no relevant information on it
can be found on the web then you leave me with the impression that you don't know how a search
engine is or should be used.

And by the way, do you know how people manage to search through this group's backlog? With the
help of a search engine.

searching the web for language stuff is
the worst way to learn. there is too much garbage out there to sift
through and google does NOT rank quality of web tutorials.

I see what you mean and you are right, there is a lot of garbage out there. Yet, you also have
the ability to judge that information and, the more you learn about a given subject and the more
you search, you continuously develop an understanding of what constitutes a good source and what
should be ignored.

Moreover, it's quite possible to extract meaningful information from "tainted" sources. So, if
you promptly discard "bad" sources of information (bad, according to who?) without even thinking
about it then you are doing yourself a disservice.

too many have
links to them which ranks them higher even though they are crap. if you
google for me in the perl usenet group you will find many reviews of
perl tutorials. the vast majority of them suck python dick. they are
buggy, incomplete, poorly written, use bad perl, etc. so that is what
you think is a good thing to google. your choice.

RM> Oddly enough, the very first document I read on perl was
RM> perl.com's beginner's introduction to Perl, which fails to mention
RM> such a fundamental aspect of Perl. So, if you happen to lurk this
RM> newsgroup to maintain that sort of info in perl.com then I have to
RM> say you have a lot of room to improve your contributions.

and did you even look at perldoc perl which shows perldoc perlsub which
covers all you needed to know?

Yes, thanks to helpful people from this newsgroup who
learning how to use docs is a skill. so
is usenet. learn them first. you have burned many potential bridges here
already. are you proud of that. you won't be getting help from some of
the best perl hackers around.

I know how to read docs and how to use usenet. What I lack is the ability to receive insults from
misanthropic idiots who acts as if everyone owes them something and believe that newbies should be
forced to assume a submissive posture before them and their condescending blurbs.

So, regarding your "burning bridges" comment, some people, no matter how technically proficient
they may be, simply aren't civilized. They, unfortunately, are unable to show any semblance of
respect or any glimpse of common courtesy while interacting with others. They simply don't know
any better and therefore are complete failures at dealing with other people. It's on everyone's
best interests to avoid any contact with those misanthropic idiots.

Thankfully, not everyone is like that. The majority of us aren't hampered by that problem and, as
a consequence, are perfectly capable of interacting with people, even capable of being a pleasure
to deal with.

So, given a choice, everyone will certainly choose to interact with the people belonging to the
latter group.

This newsgroup is opened to all. As a consequence, some decent folk subscribe to it, along with
some anti-social morons who only deal with other people if they are forced to. Everyone is free
to read any post and everyone is free to post/reply too.

This is a terribly good thing. That means that everyone is free to post questions, as everyone is
free to reply to those questions if they feel like it. If by your alleged "bridge burning" I've
managed to stave off a few of those misanthropic idiots who are physically unable to post a
helpful reply without first taking out of their system the need to insult and demean everyone in
their range... I don't see how that's a bad thing. After all, if they can't/don't know how to be
helpful then why should anyone want their help? They would be wasting their time and just
injecting pollution into this newsgroup.

And better yet, this "opens the stage" to those fellow Perl hackers who, although might not be so
proficient in the language, also manage to know their stuff. Better yet, they are more than
capable of contributing positively to the community, not only by spreading knowledge but also by
succeeding in turning the community into a healthy one, one which isn't trolled by people who
failed at life and believes the world is out to get them.

i help tons of people here. for many years. and in other areas i
contribute to the perl community. you know not of which you speak.

So, then, you should act it instead of only preaching it.

you are here asking for help but you pissed off many.

Clearly, if a simple, innocuous question made by a newbie pisses off some people then those who
were pissed off by it should simply stay away from public forums, particularly those where newbies
are free to post. They do a disservice to the community by making it look like it's plagued by
misanthropic idiots who act as if the whole world owes them something.

the culture here has existing for decades

So it's high time to fix that problem, isn't it?

and you expect to come in and be spoon fed your
way?

You seem to be confused or you simply failed to follow the thread, as nowhere I've expected to be
"spoon fed" anything. If you want to criticize me or any of my posts please base your accusations
on reality.

that isn't how the world or usenet works.

I see. You are either confused or you simply don't know what usenet is or stands for. But do
take your time to familiarize yourself with it in order to avoid making silly claims.


Rui Maciel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top