perl Questions
2
Solved
DateTime::Locale has a very comprehensive list of date and time formats for various locales and countries. I would like to use it in emails to customers, depending on which country the customer is ...
2
Solved
I would like to take control of the output generated in seconds using perl. I would like to show the time (in seconds) in the form of days, hours, minutes and seconds to make it human readable form...
Britanybritches asked 14/9, 2015 at 11:50
1
Solved
I have a library that needs to fork() to fire-and-forget some code. However when the child process spawned by fork() is destroyed, the DBD::Pg's END is called and inadvertently kills the parents co...
Kazantzakis asked 13/9 at 2:0
1
Solved
I'm having troubles debugging a Perl program where variable names (or hash key) are UTF-8 strings. The program compiles ok (and runs) but whenever I want to debug it, the debugger is quite unhappy ...
3
Solved
I'm trying to parse/extract data from an XML file and retrieve necessary data.
For example:
<about>
This is an XML file
that I want to
extract data from
</about>
<message>Hello...
6
Solved
#!/usr/bin/perl
use strict;
use warnings;
my @array = qw[a b c];
foreach my($a,$b,$c) (@array) {
print "$a , $b , $c\n";
}
I receive following error:
Missing $ on loop variable
What is wr...
4
I have a file that has newlines and then some line extension that I need to unwrap.
Example:
X123
+ a b c
+ d e f g
Y4567
+ a1 b2
+ c1 d2
+ e1 f2
Expected:
X123 a b c d e f g
Y4567 a1 b2 c1 d2 e1 ...
3
I was wondering if someone would be able to help me create commands that would allow me to add three different types of sequenced numbering to folder & filenames.
I am looking for these command...
1
Solved
The following one-line script is to rename files from e.g. Foo_Bar_Baz.txt to Baz_Bar_Foo.txt:
(rename is the rename(1) utility from File::Rename.)
rename -n 's/(\w+)_(\w+)_(\w+)/join "_"...
3
Solved
I have a large set of numbers, basically 1001 .. 150000 for a database using MySQL
There are a ton of gaps in the IDs on the database, so not all IDs exist. It can go from 100000 - 10500, then the ...
Header asked 6/8 at 19:6
1
The book "An Introduction to Mathematical Cryptography" by J. Hoffstein et al. talks about a three-line implementation of the RSA algorithm in Perl, which people used to protest US govern...
Pak asked 4/10, 2020 at 1:25
6
Solved
opendir(DIR,"$pwd") or die "Cannot open $pwd\n";
my @files = readdir(DIR);
closedir(DIR);
foreach my $file (@files) {
next if ($file !~ /\.txt$/i);
my $mtime = (stat($file))[9];
print $mtime;...
Cockaigne asked 7/3, 2012 at 11:14
4
Solved
I have a very large file, over 100GB (many billions of lines), and I would like to conduct a two-level sort as quick as possible on a Unix system with limited memory. This will be one step in a lar...
4
I successfully parsed an xls file using Spreadsheet::ParseExcel::SaveParser and modified it with Spreadsheet::WriteExcel.
However working with xlsx file is a whole different thing.
I am trying to ...
7
Solved
If I have a match operator, how do I save the parts of the strings captured in the parentheses in variables instead of using $1, $2, and so on?
... = m/stuff (.*) stuff/;
What goes on the left?
...
Gruver asked 2/11, 2009 at 13:7
10
Solved
I am setting up this example Perl snippet to validate for months in a date:
Some scenarios I want to accept are:
MM
M
#!/usr/bin/perl
use strict;
use warnings;
my $pattern;
my $month = "(0[1-9]...
1
Solved
I have very simple code that parses a file name:
#!/usr/bin/env perl
use 5.040;
use warnings FATAL => 'all';
use autodie ':default';
my $string = '/home/con/bio.data/blastdb/phytophthora.infes...
7
Solved
In RegEx, I want to find the tag and everything between two XML tags, like the following:
<primaryAddress>
<addressLine>280 Flinders Mall</addressLine>
<geoCodeGranularity&g...
5
Solved
I was able to find a page from Safari Books Online that provides a template, but having never written POD comments, I'm not sure how good it is or if it is missing anything that might be considered...
7
Solved
During a recent job interview process, I submitted some sample Perl code which used the so-called "secret" !! operator. Later, when discussing the code, one of the interviewers asked me why I chose...
Eserine asked 8/10, 2015 at 11:9
2
Solved
Today, I stumbled over something in Perl I was not aware of: it "localizes" the variable that the elements of the list iterated over is assigned to.
This, of course, is documented in the Perl docu...
Ahrendt asked 15/2, 2017 at 7:51
3
Solved
The goal is to see the encapsulated data, like I've been doing for the last 26 years.
use 5.040;
use strictures;
use experimental 'class';
class Foo {
field @member = qw(e r t);
}
my $foo = Foo-...
Pirogue asked 28/5 at 9:24
7
Solved
I'm tasked with replicating a production environment to create many test/sit environments.
One of the things I need to do is build up Perl, with all the modules which have been installed (includin...
2
ActiveState Perl - 5.26 on Windows 10 - 64 bit.
When I am trying to launch cpan from CMD - I see the following error:
C:\Users\orenm>cpan
Unable to get Terminal Size. The Win32 GetConsoleScr...
7
Solved
Global symbol requires explicit package name? Why has this occurred and what are various cases that can cause this error?
Thirst asked 29/6, 2010 at 14:1
1 Next >
© 2022 - 2024 — McMap. All rights reserved.