General :: Use "#!/usr/bin/perl" In The Beginning Of A Perl Script
Dec 17, 2010
I have a small problem with Perl and Apache.
If I use "#!/usr/bin/perl" in the beginning of a perl script the script won't work if the script is at all complicated. Simple scripts like "Hello World" works.
But if I use "#!/usr/bin/perl -w" in the beginning all scripts work?
If I don't use the -w this is whats in the logs:
(2)No such file or directory: exec of '/home/test.net/html/cgi-bin/uh/meny.pl' failed
Premature end of script headers: meny.pl
When I use the -w in the script the error-log shows me this.
meny.pl: Name "main::http_path_cgi" used only once: possible typo at /home/test.net/html/cgi-bin/uh/meny.pl line 24.
I am new here and want to lern CentOS. Current I have installed CentOS 5.5 x64 and Perl 5.8.8. Now i have install Perl 5.12.1 which located to /usr/local/bin/perl. But how I can move it to /usr/bin/perl so root based on Perl 5.12.1?
I recently reinstalled the B module for perl. Now I found out it didn't just do that, it installed a whole new copy of perl into /usr/local/bin/perl. When I type 'which perl' at the terminal, it says '/usr/local/bin/perl' instead of '/usr/bin/perl'. Normally, this wouldn't bother me. But I installed the one in local/bin without threading support. The one that comes with the system already is build with threading support, which is why I want to switch back to the system perl, and possibly remove the one in /usr/local/bin.
So how do I change it so that the result of 'which perl' returns as '/usr/bin/perl'? And what do I have to do to remove /usr/local/bin/perl?
The reason I need threading support is because I'm designing a file copier that copies several chunks of a file simultaneously to speed up the copying process. Guaranteed a useful script if it works.
Was wondering if any perl guru's could help me with a quick log file adjustment. I have a text file that looks like so (tabs and newlines are revealed so you can see what separates the data):
There are maybe 100 lines of text in this file at any given time. I need to delete all duplicate lines only looking at the first bit of text prior to the first tab. It doesn't matter which one gets deleted as long as there are no two lines that begin with that same text at the beginning before the first tab. So in this example, either the fist line "1234" or the last line "1234" would need to be deleted. I already have code in my script that opens the files - I just need the code to read the text into an array and the part that would find matches based on the above criteria, and make the deletions.
If it would be easier, I can even do a system call and use SED (v4.1.5) and/or AWK (3.1.5) instead.
I'm new in perl programming and linux OS. What is the difference between perl and perl-devel? What does mean devel? Iwant to install Catalyst and before install as required I have to check if make, gcc and perl-devel are installed in my system. make and gcc are installed. But I have to install perl-devel. First I searched for make, gcc and perl-devel in YAST Software Management and search did not find perl-devel. I visited the software.opensuse.org and wrote "perl-devel" and searched. The result was many similar zips with a prefix perl-devel and I can not choose one for needed perl-devel.
I Installed perl-doc in ubuntu 10.04 using sudo apt-get install perl-doc,in the same way I installed doc for postgreSQL. How to use perl-doc so that I can get from perl-doc.
I want the output of this file to be in a column, not next to each ohter. I tired putting a a newline escape character in a few places, but it breaks the script. It is easy in awk, just ls -ltr | awk '{print $8 }'
I had a problem recently, where a perl script was consuming server resources. I found out it was a perl script by using "top". But it didn't give the path to the script. Nor did ps.Also, ps -ef showed that the process with that pid is /usr/bin/httpd (apache), so it must have been apache serving some perl page I suppose.Is it possible to get the path to currently running perl script, if I only know the process PID of the perl process that is running that script? If so, how? I don't need the path to the perl binary, I need the path to the perl script that binary is currently executing.
I am making some scripts to automaticly install linux-software.gcc,kernel,binutils, etc.) I have made a command to extract the packages, but how can I check if I can re-use my already extracted source-archives?
I'm trying to simply pull a line (semi-static entry) from an xml file online with a shell script, or perl script. Basically, I've got a URL that loads an XML file. From this file I want to pull a text entry:
<blah xml code blah 'http://static.address.com/static_directory/dynamic_filename.123' blah xml code blah>
I would like to do this from a shell or perl script. I would like to parse the xml file so that it just pulls the http - .123 information and ends there, that's the only information I need. it will then run a local command on this file.
I want to compare two files in perl, I have two files file1.txt & file2.txt. if column1 on file2.txt match column1 on file1.txt then I want my result on file3.txt (column1 column2 file1.txt + column1 column2 column3 file2.txt). this problem was solved with "awk" but I want to do in perl.
I am trying to use awk command in perl. Below is my awk comamnd which works alone. awk '{Easttot=Easttot+$1} END {print Easttot}' MessagesProcessedEAST2Cnts.dat I would like to use this awk's output in shell script. I am using system command like below to get the out put. But it is not working. $Output = system("awk '{Easttot=Easttot+$1} END {print Easttot}' MessagesProcessedEAST2Cnts.dat'");
I have the binaries: perl-5.10.1-3.tar.bz2 and I don't have access (admin privileges) to run setup.exe for cygwin, my question is how can I install manually inside cygwin the module for perl: perl-5.10.1-3.tar.bz2?(or maybe can I get the sources and compile? can someone tell me please how?)
I am witing a file upload program in perl where i need to upload a wav or a gsm file and save it as a gsm file.How can i make sure that the uploaded file is a wav or a gsm sound file and not an executable malicious script or something.
I have procmail parsing the subject line of incoming e-mail and depositing individual files in a folder that match the procmail recipe.I want to have that recipe spawn a perl script to parse the file to pull out specific information. I've googled this and found many examples but none of them work.When it finds a matching inbound message it logs it correctly in the charge.log file, writes the message in charges/new/xxx but skips the /home/rowan/billing.pl script.
There is an AIX 5.3 Box and there are some Perl scripts that generate web pages. We use them for monitoring of logs. But the perl script, let's name it "displayLogStatus.pl", that extracts some information such as "Failed", or "Completed" from specified log files doesn't refresh the page automatically.
In PHP I know how to refresh / reload a page after a specific time interval. For example this command in a web page:
PHP Code:
header("refresh:60");
would refresh the web page every 1 minute automatically.
I am having a shell script which runs perl jobs.The script is starting the perl jobs when it is executed manually from the command line , but when the same script runs from crontab it is not starting the perl jobs.I have these things in the begining of the script
I am attempting to install zimbra onto Ubuntu Hardy 8.04 x64 bit edition using this tarball:
Code:
zcs-6.0.6_GA_2330.UBUNTU8_64.20100505202919
However when I run the install script I get this error:
Code:
Press Return to continue
Checking for prerequisites... FOUND: NPTL FOUND: sudo-1.6.9p10-1ubuntu3.7 FOUND: libidn11-1.1-1
[code]....
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at [URL] the Perl Home Page.
This is a Fix message - it is a type of protocol for transmitting financial dataeach number followed by a = sign is a tag - each tag means something. some tage are moe important than other.
I'm writing a script that gives me some pertinent info about my servers, and the last little piece I need to figure out is the process list. There are going to be non-technical people looking at the output of the script and I'm trying to make it as simple as possible.
Right now, if I do ps -ef | grep <process> | grep -v grep It obviously shows me the process, but the problem is that there is 4 lines of info in front of the process. ie
root PID date time java -1024 -cp oh,my,god,there,is,so,much,data,it,carries,on,for,4,lines,I,want,to,shoot,myself,trying,to,read,it,f inally,in,the,end,there,is,a,space /here/is/the/process I'd like the output to be something like this: PID: #### Process: /here/is/the/process
I've thought about how I could take the output and use awk or sed but I know there is probably an easier way to do it with perl.