Perl utf8 binmode unexpected results

Why does binmode as raw produce the umlaut? Could any elaboration be given regarding how 'Zurich' String is stored internally in Perl? Just a little lost. use strict; use warnings; my $filename = "result-test-encoding-raw.xml"; open(my $fh,'>', ...
more »

2017-09-05 22:09 (2) Answers

I want to output 4 byte signed integer type value

I am using a Perl script. I want to use 32 byte signed integer form like c language. For example, if I add 1 to the integer value, I want to output it as shown below. my $val = 0; while(1){ print $val++; } ------------------------------- The de...
more »

2017-09-04 10:09 (2) Answers

embedded perl in C - set working directory

How to tell the embedded perl in C what's it's working directory? It seems that it's set to the directory of the executable in which embedded perl is used. Setting the directory from outside before invoking the embedded perl stuff doesn't change it'...
more »

2017-09-01 14:09 (2) Answers

Perl: Find ranges of numbers in an array

In Perl, if I have a sorted array of integers, is there a compact way to convert it to a list or array of ranges of integers? E.g. suppose I have: my @numbers=(3,4,5,6,9,10,12,14,15,16,17); I would like a way to determine that the ranges of num...
more »

2017-08-29 22:08 (3) Answers

Using Linux Wildcard character in Perl Script

I have two files. ~/directory1/7120599_S1.txt hello world! ~/directory2/7120599_S7.txt bye world! I'm looking for Perl code that will append the contents of 7120599_S1.txt to the end of 7120599_S7.txt. The following command works in Linux: ...
more »

2017-08-26 21:08 (1) Answers

Executing Perl 6 code in Rmarkdown

I want to write some tutorials on Perl 6. For this I believe Rmarkdown would be of great help. So I am trying to execute Perl 6 code within Rmarkdown document. My Perl 6 executable is in C:\rakudo\bin. So my .Rmd file with example code to accompli...
more »

2017-08-24 11:08 (3) Answers

issue with sqlite while installing SVN::Core

I am trying to install SVN::Core in a Redhat 6 server, but every time I try to run cpan SVN::Core, it throws me an error that says: An appropriate version of sqlite could not be found. We recommmend 3.7.15.1, but require at least 3.7.12. Please eit...
more »

2017-08-23 20:08 (1) Answers

Fitting multiple curves to one data set

I have a data set that i receive from an outside source, and have no real control over. I can edit it ad infinitum, but cannot choose parameters by which to filter the set. The data, when plotted, shows two clumps of points with several sparse, irrel...
more »

2017-08-14 18:08 (0) Answers

How to avoid <defunct> processes?

I do ZFS remote replication from a master host to a slave host, where I have a Perl script that runs on the master host. For each filesystem it ssh to the remote host and start mbuffer in listening mode and then the script continues and then send th...
more »

2017-08-09 15:08 (2) Answers

Purge XML Twig inside sub handler

I am parsing large XML files (60GB+) with XML::Twig and using it in a OO (Moose) script. I am using the twig_handlers option to parse elements as soon as they're read into memory. However, I'm not sure how I can deal with the Element and Twig. Befor...
more »

2017-07-23 11:07 (1) Answers

perl: split array into matches and non-matches

I know you can use grep to filter an array based on a boolean condition. However, I want to get 2 arrays back: 1 for elements that match the condition and 1 for elements that fail. For example, instead of this, which requires iterating over the lis...
more »

2017-07-11 18:07 (2) Answers

Ruby paragraph mode vs Awk and Perl

Suppose you have a file with five blocks of data separated by two or more \n to separate the records (a common text format). If you run awk with RS="" you set awk to separate the blocks into records. You can then set FS=\n to separate the lines of ...
more »

2017-07-09 20:07 (2) Answers

SVN::Client commit with comment/message option

I am trying to automate some svn tasks with perl SVN::Client module. Unfortunately I couldn't find an option to commit a file with commit message. Currenty I am using following method. $client->commit($targets, $nonrecursive, $pool); Does anyo...
more »

2017-06-19 11:06 (1) Answers