Perl is a powerful, high level programming language. Questions about Perl should be limited to the Perl development environment, running Perl, or using Perl to automate tasks on your computer.
Questions tagged [perl]
501 questions
13
votes
3 answers
Getting the process id for current perl script
How do I get the process id for the perl process that's running the current script? getppid() doesn't return the same pid as ps -ea| grep .
Is there is an easy way or do I just run the ps -ea command within my script and trim off the other pieces…
ageis23
- 671
5
votes
2 answers
perl slurp module issue
root@bt:~/wepbuster-1.0_beta# ./wepbuster
Can't locate File/Slurp.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10…
adaasd
- 53
4
votes
2 answers
chown function in Perl
I have problems with the working of the chown function in Perl. I have a script:
#!/usr/bin/perl
$file = "";
$file = $ARGV[0];
$user = "jboss";
$group = "jboss";
if ($file eq "")
{
print "Syntax: $0 \n";
exit 0;
}
@file =…
Willem
- 399
4
votes
3 answers
How to get file size before downloading the file LWP::useragent
I wrote a script, so I can automatically download from a hotfile using LWP::UserAgent. I've managed to get the file to download properly. How do I get the file size of the file before downloading?
I need this to display hot much of the file has been…
ageis23
- 671
2
votes
1 answer
Where do I find Nmake for Windows XP
Regarding BioPerl installation in Windows XP, I have installed Active Perl in Windows XP, and by using Perl Package Manager I have installed the BioPerl Repositories too. But I am not able to run the BioPerl yet.
While running the BioPerl program in…
Shrujan
- 31
2
votes
3 answers
perl + append WORD in the end of the last line in the file
I use the following perl one line in order to append WORD in the end of the last line in the file
perl -p -i -e 's/$/WORD/;' file
But it's append the WORD in every line -
How to fix the perl syntax in order to append the WORD only on the last…
jennifer
- 1,117
1
vote
1 answer
Perl search and replace a directories
I have a script where I am reading a file in hash and using one of the values as a search $find = "pqr" and trying to replace with a directory structure $replace = "/abc/xyz/bcd"
/usr/bin/perl -0777 -pi -e 's/$find/$replace/' $file
This doesn't…
Guestme
- 11
- 1
1
vote
1 answer
BioPerl installation and execution issue
I have installed Active Perl in Windows XP. Through Perl Package Manager I have installed BioPerl repositories. But while trying to execute this BioPerl program:
#!/usr/bin/env perl
use Bio::Seq;
use Bio::SeqIO;
# create a sequence object of some…
Shrujan
- 31
1
vote
0 answers
Get sublime text 2 (sublimecodeintel) to parse mason
So Sublime Text 2 seems to getting a lot of love lately. I am using the Sublime Code intel plugin, https://github.com/Kronuz/SublimeCodeIntel for auto completion. The problem is, it does not recognize .mi files as MASON files. I looked into the…
yathaid
- 43
1
vote
1 answer
Searching current directory and 1 subdirectory for files with .txt extension
Using the 'ls -R' command in perl, what is the parameter to find files with a .txt extension under the current and 1 subdirectory? Also I how would I count the number of files and if the number is one or more do a block of code that opens the files…
Onoch
- 11
1
vote
1 answer
Rebuilding Perl the get it ready for padre
When I tried to install padre I got a message that I need a Perl with ithreads enabled.
So when I rebuild my Perl, are these configure-options OK?
sh Configure -de -Duseithreads
And if I rebuild Perl from the same source-files which I used for the…
sid_com
- 117
1
vote
5 answers
Perl + Translate shell script syntax to perl + regular expression
In my /var/tmp I have the following files:
ls | grep FILE
AAA-FILE.xml
BBB-FILE.xml
With the following command I cut the first word of the files as follows:
ls /var/tmp | grep FILE.xml | sed "s/.FILE.*//"
I get:
AAA
BBB
How can I do the…
yael
- 13
0
votes
1 answer
Cannot read output of open in Perl
I have this little bit of code in a while statement while() and it will not execute and read the output of the open(PS,"blabla") code.
How do I resolve this?
#!/usr/bin/env perl
#
my $IPendnum = 1;
my $IPrange = 0;
my $START = 1;
while…
user291903
- 15
0
votes
1 answer
Perl remove characters in a string
I have a $cbDescription variable in a Perl script. When I print out $cbDescription, I get the following:
tIP SOLD -5 /ESH4 @1832.00
I want to remove any + or - or @ signs or commas from the string, so I have the following line:
$cbDescription =~…
pacoverflow
- 1,975
0
votes
1 answer
Perl read file returning only partial lines
I am trying to write a script to rename files based on a given list. To test to make sure the list is read correct, I have:
print("start\n");
open(READFILE, "
traisjames
- 140
- 8