Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Perl: last evaluated value as a returned value for a subroutine. See inside

by moritz (Cardinal)
on Feb 21, 2013 at 17:18 UTC ( #1019988=note: print w/replies, xml ) Need Help??


in reply to Perl: last evaluated value as a returned value for a subroutine. See inside

My question is: are there any conditions when Perl would NOT print "some string" in last two lines of code?

I have trouble making sense of this question.

If you change the code, it might do something differently, depending on how you change it. If you don't change the code, it'll do the same thing each time you execute it.

If the fact that $R is returned surprises you, it might help to know that

unless ($A) { $b }

is actually compiled the same as

$a or $b

(and likewise if ($a) { $b } is compiled the same as $a and $b)

which is why branching constructs as the last statement return the value of the conditional.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019988]
help
Chatterbox?
LanX has ideas for more similar pics
[LanX]: well I gimp ed a while to make it look natural
[LanX]: ... obviously too long
[Eily]: I yes, the natural onion in the flamming eye, I know what you mean
[LanX]: Eily your turn to provide a pic :)
[Eily]: occupe toi de tes oignons
LanX could do a zoom out in animated gif ...
[LanX]: heh
[marto]: get with the times, webm :P
[LanX]: didn't know this expression xD

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-12-14 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (398 votes). Check out past polls.

    Notices?