Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Strictly nested sub warnings

by pobocks (Chaplain)
on Oct 06, 2010 at 04:09 UTC ( #863717=note: print w/ replies, xml ) Need Help??


in reply to Re: Strictly nested sub warnings
in thread Strictly nested sub warnings

Out of curiousity, why #5? I don't question that it's the case (you know better than me by job lots), I just wondered what the reason was.

for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";


Comment on Re^2: Strictly nested sub warnings
Download Code
Re^3: Strictly nested sub warnings
by ikegami (Pope) on Oct 06, 2010 at 04:42 UTC
    Especially if you're joining lots of vars with short strings, concatenation can leave you drowning in symbols.
      For short variables I agree 100%.

      For more complex variables, I tend to go back to concatenation to make sure I get what I want.

      print "Guess what you get: $hashref->{$lookup1[$i]}->{$lookup2[$i]}\n" +;

      Also, with syntax highlighting, punctuation actually makes the code more readable than interpolation IMO.

      -- Time flies when you don't know what you're doing
Re^3: Strictly nested sub warnings
by GrandFather (Cardinal) on Oct 06, 2010 at 04:42 UTC

    It's fairly minor, but using concatenation when you could use interpolation instead tends to obscure the result you are aiming for. Compare the following two print statements:

    use strict; use warnings; my $tsuJ = 'tsuJ'; my $rehtonA = 'rehtonA'; my $lreP = 'lreP'; my $rekcaH = "\nrekcaH"; print join ' ', map {scalar reverse} split / /, $tsuJ . ' ' . $rehtonA + . ' ' . $lreP . ' ' . $rekcaH; print join ' ', map {scalar reverse} split / /, "$tsuJ $rehtonA $lreP +$rekcaH";
    True laziness is hard work

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2014-10-01 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (29 votes), past polls