Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

perl

Call Perl script using operating system executable

Syntax

perl(perlfile)
perl(perlfile,arg1,...,argN)
result = perl(___)
[result, status] = perl(___)

Description

example

perl(perlfile) calls the Perl script perlfile.

On Microsoft® Windows® systems, MATLAB® ships with Perl, which is available from the Perl.org website. For information about using the Perl programming language, Perl source code, and a standard distribution of Perl, see www.perl.org.

On Linux® and Mac systems, MATLAB calls the Perl interpreter available with the operating system.

perl(perlfile,arg1,...,argN) calls the script with the arguments arg1,...,argN.

result = perl(___) returns the results.

[result, status] = perl(___) returns the exit status in status.

Examples

collapse all

Create a file hello.pl containing the following statements. Save the file on your MATLAB path.

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

At the MATLAB command line, type:

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

Input Arguments

collapse all

Perl script file name, specified as a string or character vector.

Example: 'myscript.pl'

Perl script input arguments 1 through N (if any) required by perlfile, specified as strings or character vectors. The script specifies the arguments.

Output Arguments

collapse all

Script output, returned as a string.

Script exit status, returned as an integer.

Tips

  • You might use Perl scripts instead of MATLAB code when:

    • You want to use an existing Perl script.

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

    • Perl has features not supported by MATLAB.

Introduced before R2006a

Was this topic helpful?