Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Question regarding printing Special Characters in perl

by svenkata (Initiate)
on Jan 05, 2013 at 00:58 UTC ( #1011750=perlquestion: print w/ replies, xml ) Need Help??
svenkata has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I have a simple piece of code to create Verilog templates using perl where I have to execute something like this: print "module( ... ... $display("The time is %d",$time)\n"; If I try to escape the $ and " I still get a compile error and when I escape even the paranthesis ( then it works Can someone tell me why this is happening when paranthesis is not one of the characters that need to be escaped in a perl string enclosed in "

Comment on Question regarding printing Special Characters in perl
Re: Question regarding printing Special Characters in perl
by Anonymous Monk on Jan 05, 2013 at 01:28 UTC
Re: Question regarding printing Special Characters in perl
by eyepopslikeamosquito (Canon) on Jan 05, 2013 at 01:39 UTC

    Rather than your vague problem description, in future please provide a precise, specific code snippet (embedded in <CODE>...</CODE> tags) of what is not working for you.

    An example of such a specific code snippet is:

    use strict; use warnings; print "module( ... ... \$display(\"The time is %d\",\$time)\n";
    which works for me, printing:
    module( ... ... $display("The time is %d",$time)
    You might consider using single quotes or here documents for this type of thing (see the links provided by anonymonk above for details).

Re: Question regarding printing Special Characters in perl
by Anonymous Monk on Jan 05, 2013 at 02:51 UTC
    Thanks for the Reply.Appreciate it :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1011750]
Approved by graff
Front-paged by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2015-03-31 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (670 votes), past polls