Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Entering the land of Perl

by 2teez (Priest)
on Apr 05, 2013 at 03:17 UTC ( #1027059=note: print w/replies, xml ) Need Help??


in reply to Re^2: Entering the land of Perl
in thread Entering the land of Perl

Hi manbroski,

"..Notice that I have to dereference it after the passage.." Why is that?

Did you also notice your subroutine sort_and_print_hash_keys definition

sub sort_and_print_hash_keys (\%) {..
and how you eventually used the it like so:
sort_and_print_hash_keys(%letters); # you passed a hash variable not a + hash ref.
".. But as far as the prototype passing, I was certain that it enforces a pass by reference..."

If I may suggest, you will do well yielding the wisdom of jwkrahn, as regard the usage of prototype for this reason:

When you use a reference prototype, like "\$", "\@", "\%" "...those symbols don't actually say that you must pass in a scalar reference, an array reference, and a hash reference. Rather, they say you must pass in a scalar variable, an array variable, and a hash variable. That means that the compiler insists upon seeing a properly notated variable of the given type, complete with "$", "@", or "%" in that slot. You must not use a backslash. The compiler silently supplies the backslash for you... "
from Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen
-- by liverpole, under subheading Problems with Reference Prototypes

Hope this helps.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027059]
help
Chatterbox?
[erix]: ah, that's really down at the heel point :)
[Eily]: LanX how dare you imply that I made a typo? It's true but still!
[Eily]: or is it a typo if the mistake was in my brain rather than in the process of typing?
[LanX]: they were talking about meatspace recently ...
[choroba]: a "thinko"
[erix]: my app (google, really) makes that 1530 km...
[Eily]: google tells me 1662 km ...
[LanX]: Nancy? Somewhere near Metz ...
[Eily]: must be km farenheit or something :P
[Eily]: wow, don't say that in Nancy LanX :P

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2017-12-13 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (369 votes). Check out past polls.

    Notices?