Query PubMed with Regular Expression

The Entrez Programming Utilities are a interface to Entrez query and database system at the National Center for Biotechnology Information (NCBI). With E-Utilities, we can write programs to query NCBI databases. Since the interface is a fixed URL syntax, we can query NCBI databases in any programming language. Here we demo a Perl script to que...
「點我閱讀更多」

Faster Prolog in Perl with Yaswi

In my previous post, I introduced AI::Prolog, a Prolog engine written in Perl. AI::Prolog is easy to use; however, the speed may be not satisfying. Language::Prolog::Yaswi refers to Yet Another interface to SWI-Prolog; the performance of Language::Prolog::Yaswi is better than that of AI::Prolog. Before using Yaswi, You need a SWI-Prolog compl...
「點我閱讀更多」

Perl x Prolog in AI::Prolog

Perl programming can be done in imperative, objective and functional styles. However, Perl lacks direct support in logic programming. Prolog is a logic programming language, popular in the fields of natural language processing and artificial intelligence. AI::Prolog is where Perl and Prolog cross. AI::Prolog is a Prolog compiler written pure...
「點我閱讀更多」

Show Class Name in Perl

In Perl, you do not need to declare the type of a variable in advance. Sometimes, it is confusing because you do not know the type of the variable and you do not know what method to use. By using ref with a object, you can know the class (or type) of the object. Say we want to extract some data from some xml files. XML::LibXML is Perl bindin...
「點我閱讀更多」

Sort by Hash Values in Perl

Since hash is a one-way relation, you cannot directly sort by hash values and get hash keys in Perl. However, by customized sort subroutine, you can also sort by hash values. This post shows the trick. You still need hash keys for later use, so we sort hash keys here. The catch is in the by_value subroutine. Here we pass $a and $b to the su...
「點我閱讀更多」