Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

print help

by mouser13 (Novice)
on Nov 01, 2012 at 18:27 UTC ( #1001858=perlquestion: print w/replies, xml ) Need Help??
" ;"
mouser13 has asked for the wisdom of the Perl Monks concerning the following question:

I need to print out someing in the format of %CALC{$EVAL(R2:C2 - R1:C2)}%
print "%CALC{\"" . "\$EVAL( R$c:C2 - R$pi:C2)\"}";
I keep getting Can't modify constant item in scalar assignment at CWMSDataPlugin.pm line 76, near ""\$EVAL( R$c:C2 - R$pi:C2)\"}

Replies are listed 'Best First'.
Re: print help
by toolic (Bishop) on Nov 01, 2012 at 18:49 UTC
    I see that you have solved your problem. Additionally, you could use qq to reduce some of that clutter (fewer quotes and backwhacks):
    print qq/%CALC{"\$EVAL( R$c:C2 - R$pi:C2)"}/;
Re: print help
by Riales (Hermit) on Nov 01, 2012 at 18:49 UTC
    print "%CALC{\$EVAL(R${c}:C2 - R${pi}:C2)}%";

    Perl can't divine where your $c and $pi variable names start/end in the string, so you have to wrap them in curly braces.

    Edit: Whoops, the code is right (I think), but the reasoning is wrong. Didn't notice that a colon immediately followed the variable names; that renders what I said before moot.

    Edit2: Ah, toolic has pointed out the real problem already.

Re: print help
by mouser13 (Novice) on Nov 01, 2012 at 18:34 UTC
    oops I somehow removed the varible assignment I had $ sign. Sorry

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1001858]
Approved by Corion
help
Chatterbox?
[Discipulus]: the skeleton of my module works!

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2018-01-23 12:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (245 votes). Check out past polls.

    Notices?