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

Re^2: How can we interpolate an expression??

by Rohit Jain (Sexton)
on Sep 20, 2012 at 18:33 UTC ( #994723=note: print w/replies, xml ) Need Help??


in reply to Re: How can we interpolate an expression??
in thread How can we interpolate an expression??

What I understand from this code is: -

First we are converting the expression into an array or list.. Now, had we printed out that list or array, it would have printed out its address.. So, we have added an '@' before it to get an array.. Now, because we are not using a reference variable to this list, we have used a curly braces before using '@'

Have I interpreted it correct.. Is this what happens in Perl?? Or can I get a better explanation of what is happening there?

  • Comment on Re^2: How can we interpolate an expression??

Replies are listed 'Best First'.
Re^3: How can we interpolate an expression??
by Kenosis (Priest) on Sep 20, 2012 at 18:42 UTC

    Great understanding!

    say "Product is @{[$number * $multiplier]}"; ^ ^ ^ ^ | | | | | | | + - EXPRESSION | | + - reference | + - dereference + - interpolate

      It's such a common combination of operations that it's even got a name: the baby cart.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

        Excellent, tobyink! I enjoy what it says there:

        Discovered by Larry Wall, 1994.

        It's the Discovered part that's intriguing...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994723]
help
Chatterbox?
[Corion]: marto: Great! The German Perl Workshop was a success even though things looked dire before, and I'm now back at home with two days off work still to go ;)
[Corion]: I hope things have settled down a bit for you and the boys are alright?!
[choroba]: Good morning, if a bit rainy
[marto]: life is a struggle :P I'm glad the GPW went well.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-06-29 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (655 votes). Check out past polls.