perl Questions
4
I installed JSON for PERL with command:
sudo perl -MCPAN -e 'install JSON'
but I cannot use it, use JSON; causes to error:
Can't locate JSON.pm in @INC (you may need to install the JSON mod...
7
My program reads other programs' source code and collect information about used SQL queries. I have problem with getting substring.
...
$line = <FILE_IN>;
until( ($line =~m/$values_string/i &...
2
Solved
As I have seen here, Beginning with MySQL 8.0.34, the automatic reconnection feature is deprecated. I have a lot of Perl scripts that connect to a MySQL database with something like:
my $dbh = DBI-...
11
Solved
I tried to check if XML::Simple is installed in my system or not.
perl -e 'while (<@INC>) { while (<$_/*.pm>) { print "$_\n"; } }'
The above one-liner was used for listing all module...
Financial asked 24/6, 2009 at 15:29
7
Solved
I have file like this:
pup@pup:~/perl_test$ cat numbers
1234567891
2133123131
4324234243
4356257472
3465645768000
3424242423
3543676586
3564578765
6585645646000
0001212122
1212121122
0003232322
...
3
Solved
Is it possible to use an object as a hash key?
For example, the following code allows me to use an instance of MyClass as a key but when I iterate over the keys and attempt to invoke the get_value...
10
Solved
This seems like a really simple question but somehow my Google-Fu failed me.
What's the syntax for including functions from other files in Perl? I'm looking for something like C's #include "blah.h...
12
Solved
I have a Perl script running in an AIX box.
The script tries to open a file from a certain directory and it fails to read the file because file has no read permission, but I get a different error...
7
Solved
I have problem setting up CGI scripts to be run on Nginx, so far I've found http://wiki.nginx.org/SimpleCGI this stuff but problem is that I can't make perl script run as service so that it will ru...
4
I have a running Perl process that’s stuck, I’d like to poke inside with a debugger to see what’s wrong. I can’t restart the process. Can I attach the debugger to the running process? I know I can ...
5
Solved
I would like to count the number of files inside a folder with Perl. With the following code I can list them, but how can I count them in Perl?
$dir = "/home/Enric/gfs-0.5.2016061400";
op...
Benares asked 14/6, 2016 at 20:32
4
Solved
Im getting dyld library not found error in my xcode.
dyld: Library not loaded:
/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/libperl.dylib
Referenced from: /usr/bin/perl5.18
So I...
2
It has been over 2 years since my last confession [of ignorance].
In the not-too-recent past I have had the need to debug code within a BEGIN block or in a .pm module. I recall it's enabled by a ce...
6
Solved
I have string that represents a bowling score:
X-91-55-72-X-X-X-90-82-91X
I want to use perl regex to validate this string is valid. I want to check the
following:
The frames are delimited by a d...
4
Solved
Perl provides an API via CORE::prototype, that allows you to get a prototype. This is further documented by Sub::Util which is the documented method for working with subs,
Sub::Util::prototype,
Re...
Caressa asked 10/9, 2020 at 19:27
6
Solved
I have a system script in perl. I need some equivalent of bash -x to determine what is going wrong with the script. Is there something equivalent?
EDIT: What bash -x does is that it prints each li...
2
Solved
The following Perl code fails on the second attempt of dereferencing the capturing group "ext"
use strict;
use warnings;
foreach(qw/2.1 2/){
#foreach(@ARGV){
my $out= sprintf("%.2f...
Wideawake asked 3/7, 2023 at 16:11
4
Solved
In Perl, I know this method :
open( my $in, "<", "inputs.txt" );
reads a file but it only does so if the file exists.
Doing the other way, the one with the +:
open( my $in, "+>", "inputs...
6
Solved
I want the Perl's equivalent of Python's os.path.normpath():
Normalize a pathname by collapsing redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/../B all become A...
1
Solved
In Perl, if I split a string containing newlines, like this;
@fields = split /\n/, "\n\n\n";
@fields is empty.
More examples:
@fields = split /\n/, "A\nB\nC"; # 3 items (...
4
The thread perl how can I append STDOUT of list form system call of perl script to a file led to the following solution: use IPC::Run qw( run );. On my macos 10.14.6 running perl 5.18.4, this threw...
3
I use a Mac OS X 10.8, and want to run the latexindent.pl perl script on my latex files. This script is made by https://github.com/cmhughes/latexindent.plx. When I run this script on a latexfile I ...
Roye asked 25/10, 2013 at 12:35
1
for some reason long to explain I want to do the following bitwise operations in perl:
(let's assume that 1 means true and 0 means false)
$var1="11000001";
$var2="10000101";
$y...
Redford asked 28/5, 2023 at 14:1
2
Solved
I just learned about the apparently undocumented \K behavior in Ruby regex (thanks to this answer by anubhava). This feature (possibly named Keep?) also exists in PHP, Perl, and Python regex flavor...
3
Solved
I can do the following in bash:
output=`command`
retcode=$?
Is there any way to do the same in Perl? Something like this:
$output=`command`
$retcode=???
Marozas asked 19/10, 2011 at 9:29
© 2022 - 2024 — McMap. All rights reserved.