File extension is in extensions list: Difference between revisions

Content added Content deleted
Line 27: Line 27:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
<lang perl6>my @ext = <.c .o>;
<lang perl6>my @ext = < .c .o >;


for <foo.C foo.zkl foo foo.> {
for < foo.C foo.zkl foo foo. > {
when /:i @ext $/ { say "True" }
when / :i @ext $ / { say "$_\t$/ is in the list" }
when /'.'/ { say "False" }
when / '.' \w* $ / { say "$_\t$/ is not in the list" }
default { say "(no extension)" }
default { say "$_\t (has no extension)" }
}</lang>
}</lang>
{{out}}
{{out}}
<pre>foo.C .C is in the list
<pre>True
foo.zkl .zkl is not in the list
False
(no extension)
foo (has no extension)
foo. . is not in the list</pre>
False</pre>


=={{header|Python}}==
=={{header|Python}}==