Jump to content

File extension is in extensions list: Difference between revisions

Line 27:
 
=={{header|Perl 6}}==
<lang perl6>my @ext = < .c .o >;
 
for < foo.C foo.zkl foo foo. > {
when / :i @ext $ / { say "True$_\t$/ is in the list" }
when / '.'/ \w* $ / { say "False$_\t$/ is not in the list" }
default { say "$_\t (has no extension)" }
}</lang>
{{out}}
<pre>foo.C .C is in the list
<pre>True
foo.zkl .zkl is not in the list
False
foo (has no extension)
foo. . is not in the list</pre>
False</pre>
 
=={{header|Python}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.