Skip to content

Instantly share code, notes, and snippets.

@adamcrussell
Last active October 13, 2019 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcrussell/cd492183f5a33e0de86fb8acc516a9f5 to your computer and use it in GitHub Desktop.
Save adamcrussell/cd492183f5a33e0de86fb8acc516a9f5 to your computer and use it in GitHub Desktop.
Perl Weekly Challenge 029
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";
}
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";
use ExtUtils::MakeMaker;
WriteMakefile(
"NAME" => "pwc", # Name of package
"OBJECT" => "pwc_wrap.o" # Object files
);
%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