Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How can we interpolate an expression??

by Anonymous Monk
on Sep 20, 2012 at 17:55 UTC ( #994709=note: print w/ replies, xml ) Need Help??


in reply to How can we interpolate an expression??

Can you do it without interpolation and without temporary variable?


Comment on Re: How can we interpolate an expression??
Re^2: How can we interpolate an expression??
by Rohit Jain (Sexton) on Sep 20, 2012 at 18:06 UTC
    Yes.. I can use single quotes and '.' to concatenate the results just as we do in Java..
    say 'Result is :' . $num * $multipler;
      my $arrayref = [ 4200 / 100 ]; print "The answer is $arrayref \n";
      The answer is ARRAY(0x3f8a94)

      my $arrayref = [ 4200 / 100 ]; print "The answer is @$arrayref \n";
      The answer is 42

      my $arrayref = ; print "The answer is @[ 4200 / 100 ] \n";
      syntax error at - line 1, near "= ;" Execution of - aborted due to compilation errors.

      print "The answer is @{[ 4200 / 100 ]}\n";
      The answer is 42
Re^2: How can we interpolate an expression??
by Anonymous Monk on Sep 20, 2012 at 18:06 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2014-09-18 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (120 votes), past polls