diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-10-09 18:53:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-09 18:53:49 +0100 |
| commit | fd73b551a6356fdc5cc7d113e6679834e3b5c12b (patch) | |
| tree | 77ca2658289a01f28701040cd28504ce4e02c527 | |
| parent | 3a3aa28032570a92e7de14c8d6184ad7bd3fdaa1 (diff) | |
| parent | 3a57fae62aab0eb27d12da16b67ce3f9ef58acdf (diff) | |
| download | perlweeklychallenge-club-fd73b551a6356fdc5cc7d113e6679834e3b5c12b.tar.gz perlweeklychallenge-club-fd73b551a6356fdc5cc7d113e6679834e3b5c12b.tar.bz2 perlweeklychallenge-club-fd73b551a6356fdc5cc7d113e6679834e3b5c12b.zip | |
Merge pull request #738 from duanepowell/pwc29
Commit solutions for perl weekly challenge 029
| -rwxr-xr-x | challenge-029/duane-powell/perl5/ch-1.pl | 47 | ||||
| -rwxr-xr-x | challenge-029/duane-powell/perl5/ch-2.pl | 16 |
2 files changed, 63 insertions, 0 deletions
diff --git a/challenge-029/duane-powell/perl5/ch-1.pl b/challenge-029/duane-powell/perl5/ch-1.pl new file mode 100755 index 0000000000..2b963f3e41 --- /dev/null +++ b/challenge-029/duane-powell/perl5/ch-1.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use Modern::Perl; +use Text::Glob::Expand; + +usage() unless @ARGV==1; + +my $glob = Text::Glob::Expand->parse($ARGV[0]); +my $permutations = $glob->explode_format(""); +say foreach (keys %{$permutations} ); + +sub usage { + print <<EOU; +Usage: $0 'brace-expansion' + +Note: 'brace-expansion' must be quoted to surpress bash brace expansion, ironic. +Examples: + $0 'Perl {Daily,Weekly,Monthly,Yearly} Challenge' # PWC 29 + $0 'It{{em,alic}iz,erat}e{d,}' # test from RosettaCode + $0 '{,{,gotta have{ ,\, again\, }}more }cowbell!' # '' + $0 'mkdir -p ~/project/{src,docs,test,foo}' # practical usage + $0 'apt-get install lib{file-find-rule,test-more}-perl' # '' +EOU + exit; +} + + +__END__ + +./ch-1.pl 'Perl {Daily,Weekly,Monthly,Yearly} Challenge' +Perl Daily Challenge +Perl Weekly Challenge +Perl Monthly Challenge +Perl Yearly Challenge + +./ch-1.pl 'It{{em,alic}iz,erat}e{d,}' +Italicize +Iterate +Itemized +Italicized +Iterated +Itemize + +./ch-1.pl '{,{,gotta have{ ,\, again\, }}more }cowbell!' +gotta have more cowbell! +more cowbell! +gotta have, again, more cowbell! +cowbell! diff --git a/challenge-029/duane-powell/perl5/ch-2.pl b/challenge-029/duane-powell/perl5/ch-2.pl new file mode 100755 index 0000000000..def5624c4b --- /dev/null +++ b/challenge-029/duane-powell/perl5/ch-2.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl +use strict; +use Inline C => <<'EOC'; + +void pwc() { + printf("Perl Weekly Challenge 029 Inline-C example!\n"); +} +EOC + +pwc(); + +__END__ + +./ch-2.pl +Perl Weekly Challenge 029 Inline-C example! + |
