Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^13: Order of evaluation/interpolation of references

by trwww (Priest)
on Mar 08, 2012 at 16:51 UTC ( #958493=note: print w/replies, xml ) Need Help??


in reply to Re^12: Order of evaluation/interpolation of references
in thread Order of evaluation/interpolation of references

Admittedly I'm pretty far off topic from the thread, but I prefer:

print "Take ", 1 + 4, "\n";

and like this even more:

printf "Take %i\n", 1 + 4;

But the prospect of a cleaner syntax to interpolate more... stuff than we currently can is interesting.

Replies are listed 'Best First'.
Re^14: Order of evaluation/interpolation of references
by JavaFan (Canon) on Mar 08, 2012 at 17:40 UTC
    That doesn't solve the problem though:
    sub X { state $x; $x = shift; \$x; } print ${X(1)}, " ", ${X(2)}, "\n"; print ${X(1)}, " "; print ${X(2)}, "\n"; printf "%d %d\n", ${X(1)}, ${X(2)}; printf "%d ", ${X(1)}; printf "%d\n", ${X(2)}; __END__ 2 2 1 2 2 2 1 2
Re^14: Order of evaluation/interpolation of references
by BrowserUk (Pope) on Mar 08, 2012 at 19:37 UTC

    The curse of the trivial example. Would you agree that first is a lot easier on the eyes than the latter two?:

    print "And the set contains [ { sort @a } ]\n";; And the set contains [ brown dog fox jumps lazy over quick the the ] printf "And the set contains [ %s ]\n", join ' ', sort @a;; And the set contains [ brown dog fox jumps lazy over quick the the ] print "And the set contains [ ", join( ' ', sort @a ), " ]\n";; And the set contains [ brown dog fox jumps lazy over quick the the ]

    Even with the complication of the p5 syntax, it's still nicer to my eyes:

    print "And the set contains [ @{[ sort @a ]} ]\n";; And the set contains [ brown dog fox jumps lazy over quick the the ]

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://958493]
help
Chatterbox?
[SuicideJunkie]: Just wait; someday soon, you'll be given a DB with unicode emojis in the column names.
[Corion]: marinersk: Well, I have done select statements like select sum(foo) as "Total Amount", ..., but to have a table like that makes me shudder
[Corion]: SuicideJunkie: :-D
[marinersk]: SuicideJunkie LOL
[choroba]: Woohoo! Fixed a test that hasn't run for 3 years.
[marinersk]: Corion Yes, sometimes whitespace in column headers is acceptable, but I still consider it be less than desireable if that query might get revectored for an ETL-esque process...
[marinersk]: choroba++
[choroba]: it's a long running test, so it's normally skipped unless an env var is set
[choroba]: nobody has been bothered to set the variable in the last 3 years

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2017-05-25 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?