How to execute a PL file in Linux?

5

I have a vmware-install.pl file that I need to execute. I double click it but Linux will open it in a text editor for editing. How to execute this file? Can it be done from GUI?
In file's properties says "allow executing file as program".

I have Fedora 18.


Update:
I managed to open the console and navigated to my folder. I have poked:

chmod +x vmware-install.pl
vmware-install.pl 

the last line says:

vmware-install.pl command not found...

but 'ls' lists the file there....

Ultralisk

Posted 2014-09-04T09:44:05.023

Reputation: 1 749

Answers

10

Run this instead:

./vmware-install.pl 

The ./ refers to the current directory.

If you run it without ./, Linux will look for a program called vmware-install.pl in your executable path, but the current directory is never in the path by default (for security reasons).

slhck

Posted 2014-09-04T09:44:05.023

Reputation: 182 472

1It says: usr/bin/perl: bad interpreter: no such file or directory. – Ultralisk – 2014-09-04T10:13:44.470

Make sure that the first line in the file is #!/usr/bin/perl and not #!usr/bin/perl -- in case you edited the file accidentally. – slhck – 2014-09-04T10:16:48.570

no. I didn't touch the file – Ultralisk – 2014-09-04T10:17:59.557

I checked inside the file. the first line is: #!/usr/bin/perl -w – Ultralisk – 2014-09-04T10:19:20.073

Accepted. Continued here: http://superuser.com/questions/807162/perl-not-found

– Ultralisk – 2014-09-04T10:32:38.463

1

"How to execute a PL file in Linux?"

A PL file in Linux (filename ending with .pl) is very likely a Perl-program. So run it with perl like this:

perl vmware-install.pl

It's often also possible to just:

./vmware-install.pl        #or:
where/the/file/is/vmware-install.pl

But this requires the execution bit (a chmod +x attribute) to be set on vmware-install.pl and also Perl must be installed on your Linux where the first line says (head -1 vmware-install.pl). If perl vmware-install.pl doesn't work, there might be two explanations for that: 1) your system don't have perl installed (unlikely on linux) or 2) perl is not installed in any of the folders in the $PATH environment variable. Try:

echo $PATH
perl vmware-install.pl
/usr/bin/perl vmware-install.pl
/usr/local/bin/perl vmware-install.pl
/whereever/your/system/has/perl vmware-install.pl
sudo yum install perl        #to install perl on Redhat, RHEL, CentOS etc
sudo apt-get install perl    #to install perl on Ubuntu, etc

Kjetil S.

Posted 2014-09-04T09:44:05.023

Reputation: 259

0

From the GUI:

  1. Right-click on the folder and click "Open in Terminal"
  2. Type ./vmware-install.pl

Richard

Posted 2014-09-04T09:44:05.023

Reputation: 101

I don't have this option in the pop-up menu. – Ultralisk – 2014-09-04T09:53:57.657