Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: C pre-processor in Perl

by sauoq (Abbot)
on Jul 28, 2003 at 19:34 UTC ( #278582=note: print w/replies, xml ) Need Help??


in reply to C pre-processor in Perl

#!/usr/bin/perl -P #define FOO bar print "FOO\n"; print qq(FOO\n);
prints
FOO bar
and that's reason enough for me to avoid it.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: C pre-processor in Perl
by perrin (Chancellor) on Jul 28, 2003 at 19:38 UTC
    Well, that doesn't work with the constant pragma either. Back to globals...

      I think you missed the point that code makes. Whether or not a constant define'd via preprocessing is replaced inside a quoted string depends on the quoting mechanism used. It isn't replaced with actual quotes ("" or '') but it is with the generic quote operators¹ q() and qq().

      So, change how you quote your literals and you might end up changing the literals themselves. I don't like things that change unexpectedly like that.

      1. This is, of course, because it is a C preprocessor and not a Perl preprocessor.

      -sauoq
      "My two cents aren't worth a dime.";
      

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-05-13 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (134 votes). Check out past polls.

    Notices?