Documentation

perl

Call Perl script using appropriate operating system executable

Syntax

perl('perlfile')
perl('perlfile',arg1,arg2,...)
result = perl(...)
[result, status] = perl(...)

Description

perl('perlfile') calls the Perl script perlfile, using the appropriate operating system Perl executable. Perl is included with MATLAB® on Microsoft® Windows® systems, so you can run MATLAB functions containing the perl function. On Linux® and Macintosh systems, MATLAB calls the Perl interpreter available with the operating system.

perl('perlfile',arg1,arg2,...) calls the Perl script perlfile, using the appropriate operating system Perl executable, and passes the arguments arg1, arg2, and so on, to perlfile.

result = perl(...) returns the results of attempted Perl call to result.

[result, status] = perl(...) returns the results of attempted Perl call to result and its exit status to status.

It is sometimes beneficial to use Perl scripts instead of MATLAB code. For example:

  • Perl script exists

  • Perl script preprocesses data quickly, formatting it in a way more easily read by MATLAB

  • Perl has features not supported by MATLAB

Examples

Given the Perl script, hello.pl:

$input = $ARGV[0]; 
print "Hello $input.";

At the MATLAB command line, type:

perl('hello.pl','World')
ans =
Hello World.

Introduced before R2006a

Was this topic helpful?