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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

Looking for an efficient way to query "perldelta"s for news

A common problem I have with Perl is this: I want to find out at which release some feature had been introduced. There were several "perldelta" manual pages (one for each release), but I'm ...
user avatar
  • 314
0 votes
0 answers
8 views

Is it possible to compile & install perl from source without the configuration script prepending a version to the final produced binary names?

Okay, so I'm trying to compile & install Perl from source. One issue though, when I run make install to finally install it the binary directory it outputs looks something like this: perl5.35.12 ...
user avatar
  • 1
2 votes
2 answers
62 views

Find and delete near duplicate lines with certain punctuation

I have a text file with millions of lines. Some lines contain the same alphanumeric sequence, but differ in case and punctuation. I consider these lines duplicates. I want to remove any duplicate line ...
user avatar
  • 35
0 votes
1 answer
27 views

Perl regex unable to match using hex or octal

I need to use Perl to work with a data file that contains a lot of unprintable characters, i.e. not within the displayable character range in the ASCII table. I tried writing regexes using octal ...
user avatar
  • 1
0 votes
1 answer
29 views

quote mark (U+0027) in perl substitution

I need to put two spaces between sentences in a large number of text files. A sentence ending is defined as period, exclamation, or question, maybe a close-quote, and then a space. Tabs and line ...
user avatar
  • 673
0 votes
2 answers
96 views

Trouble with perl and UTF-8

If I interpret documentation ci=orrectly, perl --CSD is suppose to ensure that input and output, processed or commands, are using UTF-8 encoding. But if I replace two hyphens -- with an em-dash — (U+...
user avatar
  • 673
1 vote
1 answer
39 views

How do I substitute the entire line in a text file for a portion of text in the line?

For example, I would like to make: >sid|RSV210|ref|NC_001803.1| SM:RSV210 turn into >RSV210 I believe that I could use sed to do this by the following "s/>.*/>RSV210/" but I ...
user avatar
0 votes
1 answer
22 views

how can I put 2 files with the same number of lines side by side with Perl

how can I put 2 files A and B with the same number of lines side by side with Perl with command line ? I cannot work with two filehandles on the command line.
user avatar
0 votes
1 answer
20 views

Perl RE global matching is not working /.*(11).*/g

I have a file containing this single line: 111112111122113 I want to match all two element sequences of 1 in all occurrences. But when I try this $ perl -lne 'print $1 if /.*(11).*/g' u I get only ...
user avatar
0 votes
2 answers
96 views

Remove the file name from a messy path in a text file awk or sed

I have an xml file with many lines containing something like this: Save="C:\Users\Administrator\Desktop\my files\1020\A54f\Drawing965.DWG" Module="0" Save="C:\Users\...
user avatar
  • 35
0 votes
0 answers
74 views

Perl, modifiers /m /s/ /ms

I have seen in Larry's Wall book programming Perl 3rd edition what do the modifiers /s /m /ms in some example with \n . Now I cannot find the exact page. Specifically the example showed that only the ...
user avatar
0 votes
0 answers
61 views

Compare/convert FTP MDTM time with/to date format

I have a Perl script that download files from an FTP site on this location/format: /A/B/2021_10.txt, the script will only download files depending on the date that is on the filename (for example ...
user avatar
0 votes
2 answers
35 views

opendmarc: hostnamefqdn() shows only short name / helo command rejected fqdn

I have problem with opendmarc. This software uses perl function to send report mails. So in the source code I see that /etc/opendmarc_reports uses also function hostnamefqdn() to pass it to helo ...
user avatar
0 votes
1 answer
100 views

500 Internal Server Error when run perl file and no access to command line

I'm a newbie with Perl. I've created a simple file test.pl with the code: #!/usr/bin/perl print 'test'; uploaded it to my shared hosting with Linux where PERL is enabled and changed my PERL file ...
user avatar
  • 177
0 votes
1 answer
272 views

Why does this regexp — which attempts to match characters between “@” characters — fail?

I need to extract the second field of selected lines in a GEDCOM file. These lines are all of the following format: % grep @ /tmp/XYZ | tail -5 0 @X701@ OBJE 0 @X702@ OBJE 0 @X750@ OBJE 0 @X765@ OBJE ...
user avatar
  • 673
-1 votes
1 answer
125 views

Need to autoincrement directory names but by avoiding some letters in the name

My script creates a set of directories aa, ab, ac, and so on This script autoincrement directory names but I want to avoid the letters: I, O, P, Q, R, W while creating directories. The script which I ...
user avatar
  • 1
0 votes
1 answer
101 views

Unable to install DBD::mysql on Ubuntu 20.04

I am unable to get DBD::mysql installed on Ubuntu 20.04. I get the following error: Warning: No success on command[/usr/bin/perl Makefile.PL LIB=/home/htm/Lib] DVEEDEN/DBD-mysql-4.050.tar.gz /usr/bin/...
user avatar
  • 11
0 votes
1 answer
33 views

Sending args from bash to perl

I eally need help I would like to send args from bash file to perl file. I dont know why it is not working for me. My code foe testing is bellow *******bash code ********* #!/usr/bin/env bash chmod +...
user avatar
0 votes
1 answer
33 views

a very simple Perl script needed

I have the following text file G.txt. I need a perl command perl -e ... that would extract all negative entries ending with Kč, so that first line it will be -107,60 and last will be -63,00 I have ...
user avatar
0 votes
1 answer
101 views

Combining two txt files containing name and last name on command line

I have two text files. First file have 20 Names listed in seperate lines and 2nd file have 20 surnames listed in seperated lines. How I can combine those files. So final text file have both first name ...
user avatar
  • 340
1 vote
1 answer
268 views

How to make fork() fail?

For a script I'm writing, it's important to properly handle a failed fork() (see https://rachelbythebay.com/w/2014/08/19/fork/ for the Why). But how, without bringing my system down with processes, ...
user avatar
0 votes
0 answers
51 views

Reading email headers in Perl

I have an email account (user@domain.com) and an alias (alias@domain.com) pointing to the account. An email sent to alias@domain.com is delivered to user@domain.com as expected. Email headers in MS ...
user avatar
  • 21
0 votes
1 answer
32 views

Perl/Bash Solution to Test if a Folder Has Changed, Then Create Copy of It

I'd like to put together a script for a very rudimentary backup system that checks a directory recursively for any changes since the date another directory (the backup) was created and, if it finds ...
user avatar
3 votes
0 answers
24 views

How to rename a perlbrew installed version

I installed Perl 5.32 with the name perl-5.32.0 $ perlbrew list * perl-5.32.0 The installation was updated with perlbrew upgrade-perl and I now have 5.32.1 $ perl --version This is perl 5, version ...
user avatar
  • 7,297
2 votes
1 answer
81 views

Shell special chars blowing up regexp(s) in all: sed, (g)awk, and perl [closed]

I would like to change the PS1 in my ~/.bashrc programmatically with any of the the most popular regexp tools { sed, awk or perl }. However, I have problems with special characters. Note that in the ...
user avatar
  • 21
0 votes
1 answer
35 views

Transpose vertically with a catch

I've been working through some issues preparing data for logstash ingestion. I have a decent chunk of the process worked out but I'm wondering if there's a better way to do this. Basically I need to ...
user avatar
3 votes
2 answers
2k views

Is there a way to execute a perl script from any location in the machine?

I'd like to know if there are other ways to execute a perl file without giving the path explicitly. example: perl ./images/seed/test.pl I read on the export path command but I don't quite understand. ...
user avatar
1 vote
1 answer
155 views

How do I upgrade SpamAssassin?

When I try to update SpamAssassin, it says it has the latest version. # cpanm Mail::SpamAssassin Mail::SpamAssassin is up to date. (3.004004) However, the latest version says it is 3.4.4. https://...
user avatar
  • 5,406
1 vote
2 answers
278 views

Regex to substitute character with numbers around it in filenames with rename utility (perl based)

I would like to rename files that have the following format: somethingblabla15T06:58_31+0000somethingblabla.bla THe new name should be somethingblabla15T06:58:31+0000somethingblabla.bla So the _ ...
user avatar
2 votes
1 answer
144 views

How to print absolute path of some file from c:\ root in perl?

Having this perl: #!/usr/bin/perl -w use Cwd qw[abs_path]; use autodie; opendir C, "c:\\"; @ar = map { abs_path($_) } readdir(C) or die $!; print $ar[0]; I am trying to print an absolute ...
user avatar
  • 301
2 votes
2 answers
72 views

Combine strings with same first word preserving their order

I have a file that contain many lines consecutive and non consecutive with same first word and i want to merge all those lines.Not finding any way. please suggest someone. eg. cat file X blah blah ...
user avatar
0 votes
1 answer
187 views

Associate .pl files with Prolog instead of Perl system wide

I'm learning Prolog at University and have a lot of *.pl files. I already managed to make gedit recognize them as Prolog files and not Perl Scripts for syntax highlighting following this question and ...
user avatar
0 votes
3 answers
548 views

sed + how to replace numbers with parenthesis with sed/awk/other

we want to relapse the [1023,1024,1022] as described in the following file , with [1022] more file.exm {"topic":"nj_hgf_dfgef","partition":0,"replicas":[1023,1024,1022]}, {"topic":"nj_hgf_dfgef","...
user avatar
0 votes
1 answer
136 views

OpenSSL Timestamp log location

I am trying to debug an openssl ts based perl http server. The server logs display an openssl ts -reply command failing with exit code 1. Where can I see the logs related to this openssl command, or ...
user avatar
2 votes
0 answers
83 views

Python and Perl not recognized in cmd even after adding in environment

It was fine yesterday, but it suddenly stopped working today. Both my perl and python were not recognized in cmd. I read as much as i can online for the answers and follow the instruction. I have ...
user avatar
  • 21
4 votes
1 answer
5k views

Add a new element to existing JSON array

How can I add "arn:aws:iam::xxxxxxx:role/3" line below "arn:aws:iam::xxxxxxx:role/2" adding a comma after "arn:aws:iam::xxxxxxx:role/2",. Before: { "Version": "2012-10-17", "Statement": [ { ...
user avatar
  • 143
1 vote
1 answer
44 views

Can I get this Perl command on Windows to not generate dates with apostrophes in LibreOffice?

Based on the help I got on this question, I have this Perl command that I run in Windows 10 PowerShell: ls |% { $_.Name } | perl -pe 's/(.)(.*)_(\d{4})(\d{2})(\d{2})_(\d+).jpg/\u$1$2,$3-$4-$5,$6,$&...
user avatar
0 votes
1 answer
71 views

How to add prefix from row at the beginning few next lines in Notepad++?

I would like to use a line as a prefix for a few more lines. For an example, please consider the situation where I have these lines: hostname-junek-1 ;ge-1/0/1 ;ge-1/0/2 ;ge-1/0/5 ;ge-1/1/27 ;ge-1/1/...
user avatar
0 votes
1 answer
30 views

removing BerkeleyDB rows using Perl

I have no experience with Perl or BerkelyDB. I have a huge BerleleyDB with a list of email and a unix timestamp. I need help to remove email with older timestamp , older than 100 days . I have this ...
user avatar
  • 97
0 votes
1 answer
66 views

perl script cannot find modules because of permission problems

I have a perl script that runs when I run it as superuser and it does not run when I am a normal user. I installed Perl from sources and typed make install as superuser. I guess this created a perl ...
user avatar
1 vote
1 answer
163 views

replace sub-string with last special character, being (3rd part) of comma separated string

I have a string with comma separated values, like: 742108,SOME-STRING_A_-BLAHBLAH_1-4MP0RTTYE,SOME-STRING_A_-BLAHBLAH_1-4MP0-,,, As you can see, the 3rd comma separated value has sometimes special ...
user avatar
  • 111
0 votes
1 answer
152 views

awk + print lines only if second field match hours:min:sec

log file is like this 34.3.23.58 07:20:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97 34.3.23.58 07:30:01 AM all 0.02 ...
user avatar
0 votes
0 answers
428 views

perl: warning: Setting locale failed. Centos 6.9

I am receiving the following error message on my Centos linux server for past 15 days. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "...
user avatar
  • 1
1 vote
2 answers
41 views

How to globally replace programming code using literal input files?

I will use HTML as an example. But it could be any programming code for any language. This comes up often enough, it would be useful to deal with the literal text code to search and replace. This is ...
user avatar
1 vote
0 answers
1k views

Perl install module fail on WIN10

I was trying to install Spreadsheet::WriteExcel module via CPAN tool for Aactive Perl(5.28.1 version). However , when I executed command "cpan install Spreadsheet::WriteExcel" , it showed some error ...
user avatar
3 votes
4 answers
543 views

What are the ways to replace a fixed string (not regex) as a whole word in command line on Linux?

What are the ways to replace a fixed string (not regex) as a whole word in command line on Linux? For example I would like to replace literal "b.*c" as a whole word, with literal "\t", without ...
user avatar
0 votes
1 answer
78 views

Unable to access config'd custom xmp namespace in exiftool

Though some form of me just not really getting it, I am unable to write this custom XMP namespace I've made in my config file. Below is the file. %Image::Exiftool::UserDefined = ( 'Image::ExifTool::...
user avatar
-1 votes
1 answer
110 views

How to create %hash which will be contains key => name of file, value => file contents?

For exemple, I have 1 file 8854 File contest is: ABCSDESG
user avatar
1 vote
0 answers
148 views

XML::Parser Perl module is not installed

Installation was successful and went well in my droplet (using DigitalOcean) but when I view the page that requires XML::Parser I still got this error message: Internal Server Error XML::Parser Perl ...
user avatar
1 vote
1 answer
486 views

How to set environment variables for DOSBox with telnetbbs

I'm looking for the exact way to implement the SDL environment variable from a perl script that is the front end for launching a dosbox BBS. I have the right approach from this link: running-dosbox-...
user avatar
  • 111

1
2 3 4 5
10