Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Simplifying code (Not obfuscation)

by theorbtwo (Prior)
on Mar 04, 2003 at 11:15 UTC ( [id://240289]=note: print w/replies, xml ) Need Help??


in reply to Simplifying code (Not obfuscation)

First thing: Don't put double-quotes around $var in your print. What you have written takes the string value of $var, and then prints that. It would have exactly the same effect to simply print $var (IE no quotes). (If that were a return instead of a print, there would be differences, in that if $var had some meaning beyond it's stringification (was an object, for an example), it would destroy that value.) Using quotes will actualy slow your code down, and make it not do the right thing, in almost all cases. (Well, in almost all cases where the only thing in the doublequotes is a single variable.)

I was going to write more here, but doubtless others will. I need to get going.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Replies are listed 'Best First'.
Re: Re: Simplifying code (Not obfuscation)
by 2mths (Beadle) on Mar 04, 2003 at 11:24 UTC
    Point taken and generally understood. Further digestion of finer points probably required. Guess I need to go learn about return now.

    Thanks for taking the time to put something. I do appreciate that it's easier to 'think' about a reply that to 'write' one. Which is why I try to make the effort to comment and thank those that do manage to 'write'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-19 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found