Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Literal Source Parameters At Runtime

by tuxz0r (Pilgrim)
on Oct 29, 2007 at 15:37 UTC ( #647865=note: print w/replies, xml ) Need Help??


in reply to Literal Source Parameters At Runtime

perl also has the -P option , which passes the program through the C preprocessor before exectution. So, using that option, you could use the exact same approach as you are in C++, using a #define.
#! /usr/bin/perl -P use strict; #define assert(exp) { if (!(exp)) { printf("assertion failed %s\n", #e +xp); } } my $var = 30; assert($var == 32); exit 0;
Output:
assertion failed 30 == 32

---
echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2023-09-21 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?