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.

learn more… | top users | synonyms

1
vote
2answers
28 views

Perl IRC Bot running on the machine

I had someone hacked into my linux machine and was running a perl code which seems to be some kind of a bot. The next day I got a call from ISP saying that there are large number of spam mails ...
0
votes
2answers
27 views

Unable to add spaces

How can i add spaces between my outputs using sed/echo or any other command in linux? Preferred Output: Virtual Machine Test01 status Running. Virtual Disk Test01 size 61GB Physical Disk ...
0
votes
1answer
27 views

Replace multiline string by another multiline string in a markdown file on OS X

I want to replace a multiline string in a markdown by another one (also multiline). I think perl is the best option. E.g. i want to replace ## Exercise 1 some text some more text ## Points by ...
0
votes
1answer
36 views

Perl replace string inside file with the filename?

I need to replace a string in a JSON file with the filename of that file. I successfully matched the string to be replaced using the regex below, but I can't figure out how to get the filename in ...
0
votes
1answer
14 views

Notepad++ Alternative string in Perl Regex

I am trying to implement some of my old notepad++ regex search in perl. I using following command. perl -i -pe 'BEGIN{undef $/;} ...
0
votes
1answer
23 views

Using hashes values and keys in Perl

Reads a sentence from the user using the <> operator, splits the sentence into an array of words (hint: use split(/regex/, $string), and outputs how many words there are in the sentence. Creates a ...
0
votes
0answers
9 views

Triplicate entries of a column

I have a data column with over 2000 entries... MV1 BNV CMG IKN ... ... I want to triplicate each entry in the column format. Result should be; MV1 MV1 MV1 ...
1
vote
1answer
299 views

How to add Perl modules using CPAN on El Capitan

When OS X El Capitan arrived, the ability to use CPAN to add or update Perl modules disappeared. It seems that the scripts either want to alter /usr/bin, which is now prohibited, or they try to use ...
0
votes
0answers
38 views

Convert two-byte hex string to char in perl

I have a string of two-byte hex characters and I'd like to convert them to an ascii or unicode string. The string can have a variable length. Input: $hex_string="003400300030" Desired output: ...
0
votes
1answer
23 views

How do I make a word frequncy counter case sensitive using command line interface in Perl?

So I have this Perl Script which is a word frequency counter. But now I have to modify this script and make it case sensitive. So if a user adds -i on the command line, the script should compare in a ...
0
votes
1answer
25 views

Save text from file between two given characters and save the output to file?

I have a file with the following kind of text: @ heading with some text the.actual.text.of.choice which.can.be.several.lines in.length.with.no.pattern + more.text.that.i.want.to ...
-1
votes
1answer
24 views

Weird perl + zsh-behaviour when running “for (1 .. 80000000) { print qq#$_\n# }”

I tried to run a script in a newly opened zsh-session which was $ perl -e "for (1 .. 80000000) { print qq#$_\n# }" So, I needed some time to type it in, then it took some time and did nothing and ...
1
vote
1answer
30 views

Generate CSV from NS Zone File

I have a large file that contains records in multilines. ex: domain1 NS ns1 domain1 NS ns2 domain1 NS ns3 domain2 NS dnsx What might be the fastest way to generate a CSV of the form ...
0
votes
1answer
51 views

Printing matching subgroups in a perl one liner

I have the regex[1] (/foo/bar/(GW|GREV)[^/]*).* I was able to get this to work with GNU sed with sed -n 's/\(\/foo\/bar\/\(GW\|GREV\)[^\/]*\).*/\1/p' But that was a modern GNU sed and I'm on ...
1
vote
1answer
25 views

When I run a git hook in a repo on a network share: which binaries are used?

See title. My repo is located on a network share. When I push new revs there, a post-udpate hook is run. The hook needs Perl and runs nicely. But which perl.exe is used here? The one on my machine? ...
0
votes
1answer
21 views

Cannot read output of open in Perl

I have this little bit of code in a while statement while(<PS>) 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 ...
0
votes
0answers
27 views

NET-SSH2 for perl 5.20.2 on windows 2008 r2

I am trying to install NET-SSH2 for perl 5.20.2 on windows 2008r2 but no success. C:\Perl>ppm install NET-SSH2 Downloading ActiveState Package Repository packlist...failed 500 Can't connect to ...
-1
votes
1answer
31 views

bash change strings with multiple escape characters

Hello i try to automate for example change one variable in php file . root /tmp # cat defaults.inc.php|egrep "reply_all_mode" $config['reply_all_mode'] = 0; I try to first catch this by grep ...
1
vote
1answer
60 views

Perl doesn't print 0x00

I wanted to experiment with the NOP SLED technique. I got the sled and the shellcode into an environment variable and I got its address. So i wanted to execute the vulnerable program and as an ...
3
votes
1answer
34 views

Accidently running perl-script with sh, how to detect that and take actions?

I had a bash-backup-script for quite some time which worked ok for me, but now I needed some features and put them into a perl-script. It works perfectly fine, and I'm happy. But my muscle-memory ...
1
vote
1answer
51 views

Is there a way to run a perl script on a windows system without having to install anything?

I have a handy perl script that I use on my linux systems to check some database information in mysql. I'd like to have a portable version of this available for Windows (specifically Windows 2008 and ...
17
votes
3answers
2k views

Command vs program?

I was looking up the difference between adduser and useradd, and an explanation is that useradd is a command while adduser is a perl script. I understand what a perl script is, but what I do not ...
1
vote
1answer
126 views

Multiple input files and output files in awk

I have a folder full of text files named 000.txt to 181.txt. How can I process all of them (on the command line) with the same awk script (program.awk) and send them to their respective output files ...
1
vote
1answer
114 views

Accidentally deleted the /System/Library/Perl folder

I accidentally deleted all the Perl related folders on my Mac (Yosemite) the one in /System/Library/Perl is the most prominent one. The curl -L http://xrl.us/installperlosx | bash command installs the ...
0
votes
1answer
799 views

Package: otrs-4.0.7-01.noarch Requires: perl(Template) while installing OTRS in centos 6

While I was trying to install OTRS 4.0.7 in centos 6, an error occurred. I tried to Google it, but I cant get the results to resolve the issue. Loaded plugins: product-id, refresh-packagekit, ...
1
vote
1answer
28 views

SED/AWK/PERL(GNU userland) - how to substitute pattern A but not pattern B?

First, I am using GNU userland so you can assume I use Bash, GNU coreutils... I have a HTML and I want to change all href="foobarz" into href="" However, I don't want to change any line ...
0
votes
1answer
59 views

Perl Archive::Zip weird response

This has really baffled me: This code works fine ... $filename="name_of_file.pdf"; for ($x=0; $x<@pdf; $x++){ $file.=$pdf[$x]; } $file=~s/\*ref\*/$new_aff/g; # converts a variable within the ...
1
vote
3answers
702 views

How to point MacVim to the right perl on OSX 10.10?

When I try to use MacVim from the command line, I get dyld: Library not loaded: /System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/libperl.dylib Referenced from: ...
1
vote
1answer
31 views

How to match parameter and replace the value after “=” separator

the perl one liner command to replace Value in file is simple: perl -i 's/oldval/newval/g' file.txt but what should be the perl one liner syntax in case we want to replace the value on specific ...
0
votes
1answer
148 views

I added a simple socket perl server script under Cygwin Xinetd to echo client input but it reads blank instead

I installed a x32 version 1.7.33 of Cygwin on my x64 Windows7 machine. I added a new service under /etc/xinetd.d/ccapi. $ cat ccapi-stream service ccapi { id = ccapi-stream disable = ...
0
votes
1answer
135 views

search and replace string using batch or perl script

How can i search for "//packages/thirdparty/release/main.txt #10" and replace #10 with #15(set VARIABLE="#15") using batch commands and also ignoring spaces. #10 can be anything, lets assume #XXX. ...
1
vote
1answer
55 views

Using Perl regex over multiple lines

I'd like to replace all occurrences of this in a file: ab ba With this: a a I tried the obvious: $ perl -i -p -e 's/ab\nba/a a/' file.txt With no success. How is this done? I can't find any ...
1
vote
1answer
120 views

how to view all process details from ps –ef command

I am using the ack.pl in my bash script to search IP's in the Linux OS only for example , and only to show the problem I will give here a short example # ( ./ack.pl -Q -a -l --max-count=1 ...
1
vote
1answer
177 views

Decode QR from image (or how to run Exec in a loop)

I need to decode a folder full of QR code from image files. After A LOT of research, I finally found a libary that works on Windows. Not my ideal choice (Zbar won't install on Strawberry PERL as ...
-2
votes
2answers
95 views

Copy sequential files into sequential directories

I need to copy multiple, sequential files into sequential directories. The files have the julian date (day of year) with other info in the file name. The directories are listed by julian date (day of ...
0
votes
1answer
71 views

Executing Perl command from shell script not resulting into anything

I am trying to execute the below command from a shell script: perl -pi -e 's/Ç/|/g' diff_new_old.dat This command gets executed without any errors, but the execution doesn't do the intended ...
2
votes
3answers
903 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
1answer
284 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
2answers
428 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
1answer
206 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
1answer
78 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
1answer
205 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
1answer
436 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
1answer
179 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
2answers
277 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
2answers
69 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 ...
0
votes
1answer
109 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
1answer
299 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
1answer
52 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
1answer
552 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 ...