Last active
October 13, 2019 13:23
-
-
Save adamcrussell/cd492183f5a33e0de86fb8acc516a9f5 to your computer and use it in GitHub Desktop.
Perl Weekly Challenge 029
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
## | |
# Write a script to demonstrate brace expansion. | |
## | |
my $statement = "@ARGV"; | |
$statement =~ m/(.*)\{(.*)\}(.*)/; | |
for my $brace (split(/,/, $2)){ | |
print "$1$brace$3\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
## | |
# Write a script to demonstrate calling a C function. | |
## | |
use pwc; | |
my $number = $ARGV[0]; | |
my $sqrt = pwc::sqrt($number); | |
print "$sqrt\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use ExtUtils::MakeMaker; | |
WriteMakefile( | |
"NAME" => "pwc", # Name of package | |
"OBJECT" => "pwc_wrap.o" # Object files | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%module pwc | |
%{ | |
#include <math.h> | |
%} | |
double sqrt(double x); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment