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

Re: understanding symbols

by dreadpiratepeter (Priest)
on Aug 03, 2011 at 19:24 UTC ( #918364=note: print w/ replies, xml ) Need Help??

in reply to understanding symbols

the first is a special variable. In this case the OUTPUT_AUTOFLUSH variable that controls whether the output is buffered. You can read about it an other variables by typing perldoc perlvar

In the second case you have a hash that contains references to arrays. something like

%h = (a => [1,2], b => [3,4]);
. the  $h0{puts} part returns a <b>reference</b> to an array. To dereference it you need to put a '@' in front of it.  so to dereference $a, you would type <code>@$a. you a more complex expression that yields a reference you would use @{} to dereference it for clarity.

Similarly, in the third example you are dereferencing a reference to a hash $hr1 to get a hash. The third could by written more succinctly as %$hr1

Typing perldoc perlreftut will teach you about references and dereferencing.

It also sounds like you could use a good introduction to Perl. I would suggest Learning Perl or Modern Perl.

"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."

Comment on Re: understanding symbols
Select or Download Code
Replies are listed 'Best First'.
Re^2: understanding symbols
by baperl (Sexton) on Aug 03, 2011 at 19:39 UTC
    thanks Pete, that clarifies. I will look up the perl docs and books you suggested :-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2015-10-10 19:05 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (257 votes), past polls