Category "perl"

How to access an element of an xml which ends with specific characters using perl

my xml file has nodes as follows, However the name of second child node is not always the same. But it always ends with the same extension, in this case text. H

Regex: why can't I use a capture group inside curly braces {}

I want to replace the nth charater of a line to '.', with n being line dependent and can be provided on the line itself, e.g. a example file can look like this:

Why is `splice(@_, 0, shift)` safe?

The perl 5.18.2 documentation of splice has this example: my(@a) = splice(@_,0,shift); my(@b) = splice(@_,0,shift); And I wonder: If @_ is evaluated before the

Can I pass the code reference of an object's method in Perl?

In a network handler dealing with various parameters to get and set I'm using closures heavily. I have a subroutine that receives a closure and builds another c

Why can I bitwise OR two strings as if they were binary numbers?

I was trying to write a Perl program that would take in two strings representing binary numbers (i.e. consisting of only the characters "1" and "0") as input a

Cgi/perl scripts display as code in Monterey

These scripts worked fine prior to upgrading to Monterey! I have followed the tutorial from “etresoft” regarding editing the httpd.conf file and res

sed "unterminated `s'command`" error when running from a script

I have a temp file with contents: a b c d e When I run sed 's#b#batman\nRobin#' temp from command line, I get: a batman Robin c d e However, when I run the c

sed "unterminated `s'command`" error when running from a script

I have a temp file with contents: a b c d e When I run sed 's#b#batman\nRobin#' temp from command line, I get: a batman Robin c d e However, when I run the c

Why the number decrements by one when converting to integer in Perl?

Why the number decrements by one when converting to integer in Perl? 23/20 * 100000000 => 115000000 int(23/20 * 100000000) => 114999999 Why?

Convert Json string literals to utf8 characters with perl or bash

I have a file full of \u codes and want to replace them all with corresponding utf8 character, for example "\u00FC" will become "ü": Here is how far I got:

perl module not found: still missing a file Telnet.pm after adding it to the path

I'm getting the following error while trying to conect via use FileHandle; use IPC::Open2; $p=open2(\*R,\*W,"cr"); $username = "m"; # your login HERE $passwd

Autoload'd calls fail via Inline::Perl5 in Raku

I'm rewriting some perl/charting software in Raku but have run into an issue using the ChartDirector perl5 module (link below) via Inline::Perl5. The module i

How to replace cpan Perl utility P5NCI with FFI:Platypus

Below is perl code which calls P5NCI::load_func to load function load_library having signature as int load_library(int dummy), hence third argument is passed as

Why aren't perl variables showing in the eclipse debugger with perl EPIC?

Here is my system configuration. Perl-Epic 0.7.8 Strawberry Perl 5.32.1 64 bit. PadWalker 2.5 installed with Strawberry perl Here is what I have already read. h

How to install Perl DBD::Oracle with Oracle Instant Client on macOS Catalina

I'm running macOS Catalina 10.15.7 and I need to install Oracle Instant Client to run run a Perl script that connects to a DB. 1. Installing Oracle Instant Clie

what the following syntax means in perl?

my $dir = $ENV{"CDSSITE_INI_DIR"}; hello, I'm new to Perl. I'm confused with the curly braces above syntax. I know it is declared a scalar variable $dir. But w

Does anyone know how to enable mikrotik router FTP using Perl script?

my %attrs = ("/ip/service/enable" , "=ftp") ($retval,@results) = Mtik::mtik_cmd(\%attrs); or ($retval,@results) = Mtik::mtik_cmd('/ip/service/enable ftp' , \%a

Finding motifs and position of motif in FASTA file - Perl

Can someone help me with this Perl code? When I run it, nothing happens. No errors or anything which is weird to me. It reads in and opens the file just fine. I

Perl: break down a string, with some unique constraints

I'm using Perl to feed data to an LCD display. The display is 8 characters wide. The strings of data to be displayed are always significantly longer than 8 char

How do I open a file only if it already exists?

This is what I am trying to achieve: open(my $file,">>","/var/opt/input.txt"); if("/var/opt/input.txt" is opened sucessfully) { do some tasks; } else {