Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am new to Unix. I am trying to Run a Perl script on Fedora 14 machine.

I wrote the script and saved it in a file called PerlOne.pl and changed its permission to 755. This is what it has

#!/usr/bin/perl
print "hello";

I tried to run it so I got

/usr/bin/perl : bad interpreter no such file or directory.

So I checked if I already have perl by typing

perl -v

I got

perl: command not found 

Is it possible that Fedora comes with no perl? or am I doing something wrong? if yes, then how can I install perl?

Any help would be appreciated =)

share|improve this question

migrated from stackoverflow.com Oct 18 '12 at 15:56

This question came from our site for professional and enthusiast programmers.

    
What's the results of: which perl? –  Steve Oct 18 '12 at 14:15
    
I wonder what will yum --showduplicates list perl show. –  raina77ow Oct 18 '12 at 14:23

3 Answers 3

up vote 5 down vote accepted

Run: yum list all | grep perl

If it doesn't show perl then you haven't got it installed.

So, install it using: yum install perl. You may need to run it as root.

share|improve this answer
1  
It didn't show perl. How to run it as root ? –  RonaDona Oct 18 '12 at 14:29
    
If you are part sudoer list then: sudo yum install perl will work. Otherwise, sudo su - give root password then run yum install perl. –  KingsIndian Oct 18 '12 at 14:31
1  
It's better practice to only use sudo, so I'd use the first option. –  reinierpost Oct 18 '12 at 14:32
    
great! how to get out of root ? –  RonaDona Oct 18 '12 at 14:34
    
It Worked! You're awesome! Thanks man –  RonaDona Oct 18 '12 at 14:35

Try searching Perl with :

find / -path '*bin/perl'

And copy-paste here the output of echo $PATH, I suspect it to be wrong.

EDIT seems like some Fedora distros don't put perl by default, see http://forums.fedoraforum.org/showthread.php?t=254537

share|improve this answer
    
It's not in /usr/bin, there should be at least a symlink in there. So it's more likely to not be installed rather than the PATH being wrong. –  Benj Oct 18 '12 at 14:21
    
See my edited post –  sputnick Oct 18 '12 at 14:22
    
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/fedora/.local/bin:/‌​home/fedora/bin –  RonaDona Oct 18 '12 at 14:25
    
yep. Installed it and it works now –  RonaDona Oct 18 '12 at 14:40

You can determine whether Perl is installed on your system by using the package manager that your system uses to install and keep track of software. In RedHat distros, the package manager is RPM.

So... To list all installed packages that have perl in their name, try:

rpm -ql | grep -i perl

(I'm suggesting using grep because IIRC rpm's internal queries are case sensitive.) If you see no results, then Perl probably isn't installed.

To install it, you'll probably use YUM:

share|improve this answer
    
Yes you're right. It wasn't installed. Thanks mate –  RonaDona Oct 18 '12 at 14:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.