Skip to main content

Questions tagged [perl]

Perl is a procedural, high-level, general-purpose, dynamic programming language, known for its native support of regular expressions and string parsing capabilities. Please use this tag for questions about Perl in general. For things related to the new (but related) language Raku (formerly "Perl 6"), please use the raku tag. For Perl-style regular expressions in other languages, use the regex tag, or, if they are based on the PCRE library, the pcre tag.

perl
0 votes
0 answers
3 views

Perl script to find and replace attributes in an XML based on values from separate text file

I have cobbled together a Perl script that replaces a specific attribute of a specific tag into what I need it to be. The script is as follows... #!/usr/bin/env perl use strict; use warnings; use XML::...
polyboi's user avatar
1 vote
0 answers
32 views

How widespread is ithread support in system perls?

I am contemplating using threads (ithreads) in a module eventually destined for CPAN. Are there any resources I could look at to see which system perls currently compile with useithreads=define by ...
type_outcast's user avatar
1 vote
1 answer
86 views

Perl DB_File Query Key is not working but key exist

I'm new with perl. I'm writing a little code to lookup value in db from key. If I do a loop on the %hash for keys and value : I can see my keys and my values. But, when I want to load a specific key, ...
Yannick MOLINET's user avatar
0 votes
1 answer
47 views

Convert string range into array of numbers in perl and prefix with another string [duplicate]

I have a string list (i.e: 1-15) and I want to generate this Scenario_01 ... Scenario_10 Scenario_11 ... Scenario_15 I tried this range=1-15 echo $range | perl -pe 's/(\d+)-(\d+)/join(" ...
jayar's user avatar
  • 1
1 vote
1 answer
43 views

How to Set return of perl function in request header using nginx

Could anyone help me with nginx with a perl module? I have already managed to create a function in Perl using the ubi8/nginx-124 image but I am not able to set the result of the function in the header....
oitathi's user avatar
  • 163
0 votes
2 answers
81 views

Shell scripting: How to replace multiple lines by another set of multiple lines in a file [duplicate]

I am new to shell scripting and I ran into an issue with the following. I am trying to create a type of script which is able to replace multiple lines in a file with another set of multiple lines (...
Frank Vermeeren's user avatar
1 vote
1 answer
40 views

How can I change app_url of Perl Kelp App

I want to change app_url. I did it as follows: package Post; use Kelp::Base 'Kelp'; use utf8; sub before_dispatch { # overriding this method disables access logs } sub build { my $self = ...
Sangyong Gwak's user avatar
1 vote
2 answers
92 views

Does Perl's POD format have a specification, is this the correct behavior?

When I render the following, =over 12 =item foo bar baz1 baz1 baz2 baz2 =item foo bar foo bar foo bar baz1 baz1 baz2 baz2 =back I get, foo bar baz1 baz1 baz2 baz2 ...
Evan Carroll's user avatar
  • 81.6k
2 votes
2 answers
95 views

Test for Unicode properties on older versions of Perl

Unicode adds new properties to the Unicode database and these are added to later versions of Perl. I'd like to be able to est if a property is allowed on my current version of Perl. I have tried perl -...
JGNI's user avatar
  • 3,973
0 votes
1 answer
49 views

MIME::QuotedPrint not encoding - what am I doing wrong?

With this code: #!/usr/bin/perl use warnings FATAL => 'all'; use strict; use MIME::QuotedPrint; my $encoded = "=4E=6F=74=65=73=0A=4E=6F=74=65=73=20=6C=69=6E=65=20=32"; print decode_qp($...
Steve Waring's user avatar
  • 2,972
-1 votes
3 answers
106 views

Converting timestamps in Perl containing timezone

I need to convert following timestamp containing ms and timezone to yyyy-mm-dd format: use Time::Piece; my $created = "2024-07-02T11:20:11.000+0200"; my $test2 = Time::Piece->strptime($...
JanFi86's user avatar
  • 499
1 vote
2 answers
114 views

How to jump to specific point of a foreach iteration?

this is a minimal working example of how to skip iterations within a list of numbers: #!/usr/bin/env perl use strict; use feature 'say'; use warnings FATAL => 'all'; use autodie ':default'; ...
con's user avatar
  • 6,065
2 votes
2 answers
80 views

How do i use "my" to declare array and element in perl?

If I have an array, say @test and refer to items in the array as $test[0], etc. how should a my statement look? one of the following? my (@test,$test); # array and element my (@test); #just the array ...
deerey's user avatar
  • 45
-1 votes
0 answers
71 views

Private variable in class method does not go out of scope [duplicate]

Please look at the following example: { package FooObj; sub new { bless { _count => 1, _data => 0 }, $_[0] } sub add_data { my $self = shift;...
steven_opp's user avatar
2 votes
2 answers
90 views

How do I remove random elements in one-go from an array using splice in Perl?

I have an array as below : my @arr = qw (ram sam ham dam yam fam lam cam) I want to remove sam , yam and lam from the above array using splice. I am using below code to do it : # first getting the ...
A.G.Progm.Enthusiast's user avatar

15 30 50 per page
1
2 3 4 5
4545