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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Yes, that is what aliasing is supposed to do.

For instance consider this:

# No aliasing... foreach my $thing (@array) { # $thing is now an *alias* for something in @array # In reality there is a layer of indirection here # from the concept of $thing to the array, but you # do not have to write the dereferencing since Perl # hid it for you in $thing # ... } # Alias over
See? There is indirection needed to do what happens in that loop, but you don't have to think about it, and it does not appear as explicit dereferences in your code. It just works.

That is the difference between an alias and a reference. With a reference the indirection shows up as your having to tell Perl to dereference things. With an alias it is hidden inside the definition of the variable.

That is an amusing difference between Perl and, say, C. The same code written in C is in reality more direct than in Perl. But the Perl code *looks* more direct because you don't see the indirections...


In reply to Re (tilly) 6: NEWBIE Brain Teaser by tilly
in thread NEWBIE Brain Teaser by nysus

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 making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 12:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found