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

0
votes
1answer
18 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
4answers
44 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 ...
0
votes
0answers
7 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 ...
0
votes
1answer
40 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
1answer
38 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
1answer
22 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 ...
2
votes
4answers
46 views

Extract 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 ...
1
vote
1answer
43 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
0answers
38 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 ...
1
vote
1answer
38 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 ...
1
vote
0answers
40 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
1answer
46 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 ...
0
votes
0answers
66 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 ...
2
votes
1answer
74 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
1answer
31 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: ...
1
vote
1answer
37 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 = ...
0
votes
0answers
66 views

Saltstack regular expression to target all except

I'm having trouble using regex with salt to target every minion except one. I have tried every example I can find and exhausted my limited understanding of Perl regex. I expect this to target every ...
-1
votes
2answers
46 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 ...
0
votes
0answers
93 views

USB Stick Becoming Write Only

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. ...
-7
votes
1answer
56 views

Regular expression for matching multiple HTML lines [closed]

<tr id="1078197327`honda`civic-sdn" title="2013 Honda Civic Sdn" class="listingRow"> I tried the following code: foreach $line (@lines){ if($line =~ m/[<]tr ...
0
votes
1answer
71 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
1answer
34 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 ...
0
votes
0answers
14 views

Convert data acceleration from HEX to decimal [duplicate]

I have an accelerometer which generated hex file with a time stamp, it has acceleration data from three axes. The data looks like this: 14:50:20.046:01 F7 C1 14:50:20.062:FA 81 C6 I need to convert ...
1
vote
0answers
13 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
0answers
31 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
1answer
26 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" ...
0
votes
1answer
57 views

Problems installing .ppd files (PERL) from CronW v2.0

I wanna test CronW to have some (acceptable) task scheduler under Windows XP, but after installing the v2.0 .exe and the .msi of ActivePerl v5.16.3 (both 32 bits), the next step of installation ...
0
votes
1answer
35 views

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 ...
3
votes
2answers
377 views

How to comment out multiple line matching a regex using sed or awk

I have a file that contains this: [...] location /static { ... multiple lines ... } [...] location /static/ { ... multiple lines ... } [...] And I want to get: [...] # ...
0
votes
0answers
46 views

How to change definition of HERE DELIM in notepad++?

I am planning to document shell scripts with embedded Perl pod as explained here: http://bahut.alma.ch/2007/08/embedding-documentation-in-shell-script_16.html The problem is Notepad++ has a narrow ...
0
votes
0answers
16 views

Can One Extract a Hyphenated Filename File From a Server Using Curl?

The images I'm dealing with have file names like part-1.jpg, object-a.jpg, Aspect-0.jpg. What I'm wondering is what I put in place of ???: curl -O http://server/[???].jpg
6
votes
2answers
531 views

Macport upgrade fails with subversion-perlbindings conflict

I'm trying to do a port upgrade outdated, but it stops on a package conflict that I'm not able to fix. Does anyone know how to fix this problem? sudo port upgrade outdated ---> Computing ...
0
votes
0answers
166 views

Template toolkit aware editor for Jetbrains IDEA

I work with Template toolkit files in a large perl project but in my favorite IDE, Webstorm/IDEA I can't find support for TT files. ATM I use the HTML editor do work with TT files but its not ideal. ...
0
votes
1answer
63 views

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, "<prune.txt") || die "Couldn't open ...
1
vote
2answers
95 views

Perl comments on a Mac

I am trying to run a Perl script I wrote from the command line. The code is: #!/usr/bin/perl #open file open(READFILE,"<prune.txt") || die "Couldn't open file"; #read line while (<READFILE>) ...
1
vote
1answer
164 views

Installing libpng on a Mac with Maverick

I want to install libpng library on my Mac, which runs under Mavericks. Here is a simple Perl script to check if it is ok: use GD; my $gd = GD::Image->new(); my $ok = $gd->can('png') ? 'Yes' : ...
1
vote
1answer
89 views

Which tool is most flexible for searching my whole system, locate or mdfind?

Follow-on to Spotlight and the locate command don't search *all* folders: The steps mentioned by Gordon Davisson were performed; .bashrc was entered in the Spotlight search field, and System and ...
2
votes
0answers
1k views

Xcode: create new custom templates and code snippets?

I'm trying to tame Xcode for writing things in Perl. Naturally, I'd like to use the "IDE features", not just the text editor. That includes Perl-specific templates, which brings me to the question: ...
0
votes
0answers
33 views

Bugzilla mail template not supported in outlook

I have installed bugzilla 4.2 version in linux centos 6.4. Everything working fine except mail format. It is not supporting in outlook. whenever we raising the bug from bugzilla mail delivered in ...
0
votes
1answer
106 views

Find number in string and replace it

I wrote C++ code and now I want to replace the number in a string by using shell scripts. The part that needs to be replaced: if (random<=90) How I can change the 90 from a shell script? I ...
0
votes
2answers
71 views

sum numbers in different lines in shell

i have 8000 lines similar to this <Flow flowId="1" timeFirstTxPacket="+0.0ns" timeFirstRxPacket="+924100.0ns" timeLastTxPacket="+199984927558.0ns" timeLastRxPacket="+199675473275.0ns" ...
0
votes
1answer
69 views

Rename files from in1.jpg, in2.jpg, in3.jpg, etc to out0001.jpg, out0002.jpg, out0003.jpg etc using perl script `rename`

I would like to rename a large number files with names in1.jpg, in2.jpg, in3.jpg, etc to out0001.jpg, out0002.jpg, out0003.jpg, etc. Grateful if somebody would suggest a solution using the perl script ...
1
vote
1answer
381 views

extract characters between first and second underscores of filenames and count such files in linux folder

I would like to extract characters between first and second underscores of filenames in a folder and count such type of files present in it. The folder contains files in a particular format such as : ...
0
votes
1answer
59 views

Perl script to fetch a particular directory and modify the xml file

I have written a perl script to modify xml file which is working fine for only one file. I want my script to fetch the xml folder and modify the xml file inside it. Like that it should run for all the ...
-2
votes
1answer
150 views

perl scrip to insert multiple line after a specific string

I am trying to insert multiple line between a two specfic line in perl. But my code is having some issue which i am not able to figure it out. open(FILE,"abc7.xml") || die "Can't open file: $!"; ...
0
votes
0answers
181 views

Installing R core rpms on centos - Need a best way to resolve dependencies

I am newbie to the Linux. I need to know the best way to handle the dependencies. The issue is, I need to install R - core and R - dev (R language packages) on an platenized centos linux host on ...
0
votes
0answers
25 views

PERL executable size getting reduced automatically after few days

On one of my RHEL 5 machine, there is one PERL executable which runs under cronjob at frequent intervals of time. The strange thing observed is PERL executable size is getting reduced automatically ...
0
votes
1answer
90 views

SortTV perl script error

I'm trying to use a perl script named SortTV (http://sourceforge.net/projects/sorttv/) Every dependencies is installed but I got an error & can't understood it... It's not a specific problem of ...
0
votes
1answer
747 views

Install XML::Parser

I'm trying to install some perl module but got strange error. sudo cpanm XML::Parser cp Parser/Encodings/iso-8859-5.enc blib/lib/XML/Parser/Encodings/iso-8859-5.enc make[1]: Entering directory ...
0
votes
1answer
303 views

Install perl module with dependencies

I'm trying to install a Perl module like this : pi@raspbmc:~$ sudo cpan HTTP::Date Cpan get the file Checksum is ok uncompressed successfully But I got this error : Using Tar:/bin/tar xf ...