Questions tagged [perl]
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.
501
questions
2
votes
3
answers
2k
views
Making a juniper VPN work on linux
I've tried several tools, the original scripts (ncsvc and ncui) do not output any error message to know what wrong with connection, even with wireshark I could not know what was wrong. The best tool I ...
1
vote
2
answers
1k
views
OSX 10.10 select perl 5.16 instead of 5.18
I find that my OSX 10.10 comes with perl 5.16 and 5.18. By default, when I run perl, I am using perl 5.18. Is there way for me to run perl 5.16 when I run perl command?
admins-Mac-mini:~ ...
0
votes
2
answers
2k
views
How to call perl file every minute from batch file
I have written a perl script which i try to call every 1 minute from a batch file.
There is no error but it do not call it every 1 minute. It just pop command prompt when clicked once on .bat file. ...
0
votes
1
answer
608
views
How to delete a particular line in a text file after some operation on that text file at the same time
I am perl bginner (but i guess logic is same for all programming languages like C++ and C in my case its perl).
What i want to achieve ?
I have a text file i read that file which contains different ...
1
vote
1
answer
179
views
How to get the count of a string from a text file . The output is wrong
I have written a code for finding the IP address count from a text file. if similar IP dress exist in file toto.txt :
My code to do this is:
use strict;
use warnings;
my %count;
my $str ;
#my $file ...
0
votes
1
answer
3k
views
How to stop a running .bat file which runs after every 10 minutes
I have written a .bat file which runs every 10 minute. The problem is now when i want to stop it it never stops. (This .bat file further calls a perl file in the code).
What can be done to kill it ? ...
0
votes
1
answer
837
views
mod_perl not active on Apache/2.2.15 (Red Hat)
I am using OTRS on a RedHat 6.5 with apache2 and mod_perl2.
One of my servers (Sandbox environment) has the following (yum info feedback):
Installed Packages
Name : httpd
Arch : x86_64
...
2
votes
1
answer
261
views
When trying to start Apache - Cant load “Magick.dll” for module Image::Magick?
I have ActiveState Perl 5.10 installed on Windows 2008 machine. I installed ImageMagick-6.8.7-9 Q16 (32-bit) installed. Instead of using ppm to install PerlMagick I built it myself using dmake and gcc ...
0
votes
4
answers
3k
views
Text deletion between patterns across multiple lines with respect to text inside pattern
I have a block of text I need to delete, however, only if it contains specific text inside the block:
...
<script language="JavaScript">
var somethingA = 0;
var somethingB = 0;
var ...
1
vote
2
answers
767
views
Replacing several strings in a file in one go
Suppose I want to replace all AAA with BBB and all BBB with AAA in a text file.
The thing which looks an obvious solution (in Perl or in Sed) is:
s/AAA/BBB/g; s/BBB/AAA/g;
But this does not work ...
0
votes
1
answer
428
views
What are MINIMAL necessary reqirements to run Perl CGI scripts on Apache server?
I have my Apache showing perl scripts as plaint text, not executing them. Googling and playing with settings made me frustrating, because there are numerous and long samples, which are mostly ignored ...
0
votes
1
answer
1k
views
FreeBSD make error - File 5.19 supports only version 12 magic files. /usr/share/misc/magic.mgc is version 8?
I'm having trouble reinstalling ProFTPD on a FreeBSD 10.1 setup. The server is newly upgraded from 10.0 to 10.1. When I start the make install clean process, these warnings first shows on screen.
===&...
0
votes
1
answer
323
views
How can I run this Perl script in Windows?
I am trying to run a PERL script for the first time.
Here it is : http://search.cpan.org/dist/HTML-ExtractMain/lib/HTML/ExtractMain.pm
I have never used or worked with PERL before and I am finding ...
1
vote
1
answer
2k
views
Amavis - How to blacklist using regex, from an external file
I currently have this line in my amavis user config file:
# BLACKLIST
read_hash(\%blacklist_sender, '/etc/amavis/blacklist');
It works fine with entries such as:
.baddomain.net
.spam-galore.net
...
3
votes
2
answers
722
views
Make perl regex search exit with failure if not found
With grep I get a failure return code/exit status if no result is found.
How can I do the same thing with perl?
Basically, I would like to change the following so that it exits with status 1 if no ...
0
votes
1
answer
41
views
Where can I see the log statements of a task in Windows 8?
I created a task in task scheduler which essentially runs a perl script. I have some print/log statements in the script. Where can I see these log statements?
0
votes
1
answer
41
views
i need to pass a string of an output file to a variable so as i can use it globally all over my script [closed]
sample output
RETENTION_INTERVAL
------------------
10080
I need to pass the numeric value "10080" from the output file to a variable .The condition should validate value and ...
1
vote
0
answers
3k
views
PowerShell issues with spaces in directory names
PowerShell has issues with spaces in directory names.
I am trying to execute a file in the same directory as the PS1 script like so:
.\getGravatarsForGource.pl
It works fine when the directory ...
-1
votes
2
answers
387
views
How can I set a count down timer in perl for doing a function repeatedly?
I am copying a file from one file to another. I want to check whether the source file is available or not repeatedly in every 10 secs. How can I check it in between copying?
0
votes
1
answer
99
views
How to wait for 3 mints if the n/w got disconnected while copying in Rsync without failing using perl script?
I have to transfer 2-3 GB using Rsync.Everything is working fine, but my network got disconnected sometimes, and the entire process got failed.
I want to retry it for the network for every 3 mints, ...
1
vote
1
answer
776
views
How do I use MacPorts' Perl installation with MAMP?
I have MAMP 3.0.6 and MacPorts 2.3.1. There are some Perl modules that I need to use (through some CGI scripts), I installed them on the MacPorts Perl installation (e.g., p5.16-dbd-mysql), but I can't ...
6
votes
1
answer
3k
views
Error while installing Perl package Term::ReadKey in Cygwin
I'm trying to use git via cygwin
Well, I used this command to clone the svn content to a local git repository:
git svn clone svn://path/to/my/project --username myuser
Git was returning:
...
1
vote
1
answer
3k
views
Missing Switch module on exiting Perl installation
I have been working on a Linux 64bit cluster for months, and this morning it seems as if the Switch module for Perl has disappeared from the system.
If I do a find on the place where I expect it to ...
-1
votes
2
answers
2k
views
how to split a hex file into two hex files at the first match of certain criteria in perl or just unix scripts
I have a HEX file containing following, I want to split them into two HEX files based on the address:
file_in.hex
@00000000
00 FC 00 20 89 01 00 00 D9 01 00 00 DB 01 00 00
DD 01 00 00 DF 01 00 00 E1 ...
0
votes
1
answer
954
views
Wrong apache configuration. Perl scripts cannot execute
I've got wrong apache configuration. My script don't want to be executed and browser trying to download it as a file.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName president.com
...
9
votes
3
answers
76k
views
How to execute a PL file in Linux?
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 ...
6
votes
3
answers
5k
views
Autoformat for Perl in Vim
I've got a piece of badly formatted Perl code:
if ($a==1){
&err_report("$a");
while($b!=1){
&err_ok();
}
}
I want to reformat it in Vim. After using the command gg=G,...
0
votes
1
answer
2k
views
Replace negative values in a file with zeros
I want to replace all negative values in a file with zeros. How can I do this in awk?
I tried with gsub but gsub(-*, 0) doesn't work... Any ideas?
My "code" is
awk '{gsub($(!/-/),"0",$2); print $1 "...
1
vote
4
answers
924
views
How to rename a lot of files in bash shell?
Sorry for the question. I searched the internet a lot, but couldn't find an answer which worked (though there were a lot of suggestions).
So, I want to rename A LOT of files. Writing all file names ...
1
vote
1
answer
166
views
Windows Server 2008 R2: perl ppm doesn't see modules unless I'm the system administrator
I just did a fresh install of ActiveState Perl 5.16.3 on a Windows Server 2008 R2 system, and things seemed to go OK until I went to review the installed modules with Perl Package Manager (PPM).
When ...
4
votes
1
answer
4k
views
Is it possible to open a port for listening without netcat?
I have a need for a Linux system to listen on a TCP port and dump what it receives to a file and/or stdout. The system does not have netcat installed. I have root permissions, but am not allowed to ...
0
votes
1
answer
1k
views
TC command via webpage as a sudo
The main goal- run a tc command via webpage, starting with:
tc qdisc del root dev eth0
(deletes all the filters)
Following Simple linux commands from a webpage
I am trying to add a tc command, but ...
-1
votes
1
answer
214
views
editing column of a text file
abc.txt consists of two column data as
1 A1021
2 A1021
3 A1022
4 A1022
I want another test file, say pqr.txt (replacing A1021 by 1 and A1022 by 2 and so on).
I used the following usual perl ...
4
votes
5
answers
2k
views
Exclude lines based on long list of line numbers
I have a long list of line numbers (35389208) that I do not want in my file. By line number I mean the line in my file (e.g. line 277). My list of line numbers I do not want looks like:
277
278
279
...
4
votes
1
answer
7k
views
How to get list of process ids that are in a given group id
Going by the man page, I would expect this to work:
ps ah -o pid,pgrp -G 18322
But this shows exactly the same list as without the -G arguments. I want a saner way to produce this output:
ps ah -o ...
1
vote
1
answer
1k
views
Notepad++ does not print to console from perl script
I have following perl script:
print "test: ";
my $input = <>;
print "result: ", $input;
I made NppExec command in Notepad++:
NPP_SAVE
perl "$(CURRENT_DIRECTORY)\$(FILE_NAME)"
When I run this ...
1
vote
1
answer
137
views
Script not running as cronjob
I got a script which runs in a cronjob as root.
The problem is that the addgroup command would output "Command not found" when it gets executed by the script.
#!/usr/bin/perl
$datei = `ls /var/www/...
1
vote
0
answers
2k
views
XCOFF32 object files are not allowed in 64-bit mode while installing Crypt-SSLeay-0.65_02
I am installing a Perl package Crypt-SSLeay-0.65_02 in an AIX 6.1 system but while performing perl Makefile.PL getting the following error.
The test suite can attempt to connect to public servers to ...
0
votes
1
answer
418
views
SED: syntax error at script.pl line 19, near “;$'”
I am using this command to delete multiple occurrences of a line in my script and it just works fine when I run it on the command prompt. However when I use this line in my perl script it throws an ...
1
vote
1
answer
913
views
Why does cpanm fail on distributions without proper makefiles where cpan -i succeeds?
I'm on Strawberry Perl on Windows 7 64-bit. cpanm fails like this for many packages in cpan:
$ cpanm Getopt::Long::Descriptive
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Getopt-Long-...
2
votes
1
answer
2k
views
Use perl to do multi-line replacement [closed]
I have to do some replacements in many *.c files. I want to do the replacement like this:
original: printf("This is a string! %d %d\n", 1, 2);
result: print_record("This is a string! %d %d", 1, 2);
...
-1
votes
1
answer
2k
views
Get value on perl script from another perl script [closed]
I have two perl scripts. The first perl script call another perl script, and then I want to get the result from the other script and use it in the first script to made a condition.
I use:
system("...
1
vote
1
answer
417
views
send sms with perl and google voice
I try to send sms to my mobile phone with perl and google voice.
I have installed google::voice module with perl :
perl -MCPAN -e "install Google::Voice"
perl script:
use Google::Voice;
my $g = ...
-1
votes
2
answers
349
views
Converting Perl Regex to PHP [closed]
I have the following Regex in PERL which I need to convert to PHP
if($line =~ m/[<]div class="row.* id="(vm_[0-9]{8,9})"[>]/i){ }
I currently have the following in PHP to match it, but I'm not ...
0
votes
0
answers
162
views
USB Stick Becoming Write Protected [duplicate]
I am running windows 7. I have a 2GB flash-drive running a strawberry Perl portable edition. I was spending time installing CPAN modules this morning when suddenly my disk became write protected. ...
2
votes
1
answer
4k
views
How to get sha1sum to work on Mac OS X?
I have an application that I'm porting and as part of the test suite, I run sha1sum. I'd like to have test code that works on all my platforms and not vary across platforms. Mac OS X, is the first ...
0
votes
1
answer
67
views
What regex pattern would I have to use to parse out unwanted characters in this format?
#!/usr/bin/perl
POSIX qw(strftime);
my $time = strftime("%YT%mT%d TTTT%H:%M", localtime);
print ("Todays date and time is $time\n");
I am a little rusty at regex, what would be a pattern to search ...
1
vote
1
answer
90
views
Using Perl to communicate with Nut
I'm trying to communicate with my UPS that's managed using NUT. I want to read values from it like line voltage, battery charge, etc. I don't want to send it commands to shut it down.
At first I was ...
0
votes
0
answers
74
views
open a new screen in linux, no access to perl local library
I added my perl local library to my shell startup script (.bashrc) and when I start a terminal in linux:
$ echo $PERL5LIB
/home/perl5/lib/perl5:/usr/share/vcftools/perl
BUT
when I open a new ...
1
vote
1
answer
146
views
error in /usr/share/perl5/iCal/Parser/HTML.pm on debian
how to fix this? when i type perl /usr/share/perl5/iCal/Parser/HTML.pm i get
syntax error at /usr/share/perl5/iCal/Parser/HTML.pm line 64, near "$t qw(week month year)"
Global symbol "$t" ...