Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
unless absolutely necessary...mucking about with the symbolic table--just to implement a shortcut to a programming problem--is generally not a great thing. in this particular case i think a closure would be a cleaner solution. even if you're just learning about symbolic table by using some code..it's better to have example code that uses the symbolic table for good reason, or you could get into a habit of using symbolic table in a similar fashion to the artificial example provided. anyway, that's my rant about symbolic tables in perl.
i like to read the ampersand in similar way to reading C, where it's literally "address of" operator. it's not exactly that in perl, but probably close enough for most purposes. so in that context the example line starting with ampersand would read: the address of an anonymous sub containing code/literal "color" is assigned the sub on the right hand side.
but as per my rant...it would be less error prone and clearer to have a sub that takes the color as a parameter, and do something with that. with subs/functions things are easily extended..you get into a fight with symbolic table manipulations if you (for example) add similar code for handling (say) transparency and visibility etc other parameters. the main program starts looking like spaghetti code.
the hardest line to type correctly is: stty erase ^H

In reply to Re: typeglob/symbolic reference question by aquarium
in thread typeglob/symbolic reference question by 7stud

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 wandering the Monastery: (4)
As of 2024-03-29 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found