perl - Call Perl script using operating system executable - MATLAB (original) (raw)
Call Perl script using operating system executable
Syntax
Description
perl([perlfile](#d126e1308528))
calls the Perl scriptperlfile
.
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](#d126e1308528),[arg1,...,argN](#d126e1308550))
calls the script with the arguments arg1,...,argN
.
[result](#d126e1308576) = perl(___)
returns the results. Use this option with any of the input arguments from the previous syntaxes.
[[result](#d126e1308576), [status](#d126e1308593)] = perl(___)
returns the exit status in status
.
Examples
Create a file hello.pl
containing these statements:
input=input = input=ARGV[0];
print "Hello $input.";
Save the file on your MATLAB path.
At the MATLAB command line, type:
Input Arguments
Perl script file name, specified as a string or character vector.
Example: 'myscript.pl'
Perl script input arguments 1 through N (if any) required byperlfile, specified as strings or character vectors. The script specifies the arguments.
Output Arguments
Script output, returned as a string.
Script exit status, returned as an integer.
Tips
- Consider using Perl scripts instead of MATLAB code when:
- You want to use an existing Perl script.
- You want to preprocess data quickly. MATLAB reads Perl script formatting more easily than other formatting.
- Perl has features not supported by MATLAB.
Version History
Introduced before R2006a
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.38.2 for information about using this version.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.38.0 for information about using this version.
MATLAB also supports an updated version of HTML::Parser, version 3.81. For a standard distribution of HTML::Parser, source code, and information about using HTML::Parser, see https://metacpan.org/pod/HTML::Parser.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.36.0 for information about using this version.
MATLAB also supports an updated version of HTML::Parser, version 3.78. For a standard distribution of HTML::Parser, source code, and information about using HTML::Parser, see https://metacpan.org/pod/HTML::Parser.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.32.1 for information about using this version.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.32.0 for information about using this version.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.30.1 for information about using this version.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.26.1 for information about using this version.
To use the perl
command on Windows platforms, go to https://perldoc.perl.org/perl and select Perl version 5.24 for information about using this version.