[tpm] how to conditional compile

arocker at vex.net arocker at vex.net
Fri Nov 27 15:54:34 PST 2009


How about using references?

#!/usr/bin/perl

use strict;
use warnings;

my $name;

if (@ARGV) {
    $name   = \suba();
}
else {
    $name   = \subb();
}
my $x   =   $name;

sub suba    {
    print "I'm a Mac\n";
}

sub subb    {
    print "I'm a PC\n";
}
#   subs Ends

It should be obvious how to test this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subs
Type: application/octet-stream
Size: 288 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20091127/d2fed82f/attachment.obj>


More information about the toronto-pm mailing list