Skip to main content
2 votes
1 answer
120 views

Split hash by array value

If there's a hash where one of the values is an array, what's the shortest way to split into an array-of-hashes (AoH) for each array value that keeps all the hash keys and values, except for replacing ...
Richlv's user avatar
  • 4,245
1 vote
2 answers
103 views

Substitute if not in group of characters

How can I substitute every character that is: not WORD (a-z, A-Z, 0-9) and also not minus (-) and also not hash (#) to underline (_) e.g. "aB-09 !#" => "aB-09__#" &...
chris01's user avatar
  • 12.7k
0 votes
1 answer
137 views

monitor json files in streaming mode [closed]

I want to monitor JSON output in streaming mode. I have an external application that outputs nested JSON for new items in real-time. When new items arrive, I want to parse the JSON and print some of ...
dave's user avatar
  • 1,247
1 vote
0 answers
79 views

Problem with mn_def_pars() function in PDL::Minuit

This package of the Perl Data Language https://metacpan.org/pod/PDL::Minuit When I run only the parameter definition part of the example program: use PDL::LiteF; use PDL::Minuit; mn_init(\&$chi2, {...
Enredanrestos's user avatar
2 votes
3 answers
146 views

How to properly replace long strings in Perl

Let's say I want to replace every occurrence of 12345 in file1 with the contents of file2. The following code works: use strict; use warnings; local $/; open my $fh, 'file1' or die "$!"; ...
Ivan's user avatar
  • 359
2 votes
1 answer
131 views

How do you decode a JSON boolean to a Perl boolean?

I would like the following code to round-trip properly on Perl ≥5.36. ❯ perl -MCpanel::JSON::XS=decode_json,encode_json -Mbuiltin=false,true -MDevel::Peek=Dump -E' say Cpanel::JSON::XS->VERSION;...
daxim's user avatar
  • 39.3k
1 vote
4 answers
231 views

Multiple replaces between markers but not outside them

To avoid some confusion and questions, I changed the new string to "letters", so it would not match "text", so to avoid infinite loops. I work under Windows, with the perl provided ...
virolino's user avatar
  • 2,331
3 votes
1 answer
88 views

Why is AnyEvent slowing down or leaking memory?

While writing a new Perl module which was capable of using AnyEvent, my benchmarking tests showed that it was slowing down dramatically over time. Turning off AnyEvent cured the problem, which ...
TFBW's user avatar
  • 1,259
2 votes
3 answers
128 views

When setting pattern property from a string in JavaScript, how to preserve the backslashes?

Related to Properly simulate "pattern" attribute with javascript: How do I set an input pattern using JavaScript? when I try element.pattern = 'a\S' (as a trivial example), then the pattern ...
U. Windl's user avatar
  • 4,778
-2 votes
1 answer
135 views

How can I tell if lighttpd is running on Debian 13? [closed]

My task was to port debian12 to debian13. In debian13 I noticed that the website was behaving differently with Perl v5.40.1. I found out that the following line returns different values on different ...
Namal's user avatar
  • 289
-1 votes
2 answers
94 views

How to use Perl `eval` to build a closure that executes the command in a string

In a CGI script that processes arrays of strings the user can supply for each field whether to match a string there or not. If all user-specified criteria are fulfilled, the specific array should be ...
U. Windl's user avatar
  • 4,778
-3 votes
0 answers
145 views

Can user-supplied regular expressions be made safe in Perl? [duplicate]

I have a HTML search form that allows the user to input strings to search for. For several reasons the strings the user enters are transformed to rather complex regular expressions, but the user-...
U. Windl's user avatar
  • 4,778
2 votes
1 answer
82 views

Disable Perl warnings for call to remote function

I'm defining some tests for a library I'm using. One of my tests is calling the code in such a way that it produces warnings, which is expected. However, I'd ideally like to suppress these warnings ...
plentyofcoffee's user avatar
0 votes
0 answers
74 views

Par:Packer: "Failed to execute temporary parl" when try to pack a .pl file to exe

I try to pack a .pl file to executable on windows, I have strawberry-perl-5.40.2.1-64bit-portable and par:packer installed, also Tk is installed. But it keep report error when execute pp -o a.exe a.pl ...
Lamp's user avatar
  • 434
0 votes
1 answer
93 views

Packaging two scripts with system dependencies for NixOS deployment?

In my quest to get to know Nix and NixOS better, I'm going to try moving a small utility I have onto my NixOS server. There are two components to this utility: A Perl script, which requires both (a) ...
kqr's user avatar
  • 15.1k

15 30 50 per page
1
2 3 4 5
4555