perl Questions
3
Solved
I have an English language forum site written in perl that is continually bombarded with spam in Russian. Is there a way using Perl and regex to detect Russian text so I can block it?
Sour asked 9/9, 2009 at 8:2
5
Solved
I found that installing native Debian or Ubuntu Perl packages, such is often more reliable and convenient than "manually" installing Perl modules via cpanm (especially for XS-Modules). Is there an ...
Dipeptide asked 18/9, 2014 at 6:50
4
Solved
I have a script that redirects STDIN/STDOUT to a file normally. But, debugging is a lot more efficient if it doesn't do that. Is there a $DB:xxx variable or something that lets the script know so i...
4
Solved
I have some module, and want to make alias for some sub. Here is the code:
#!/usr/bin/perl
package MySub;
use strict;
use warnings;
sub new {
my $class = shift;
my $params = shift;
my $self ...
Hulse asked 9/7, 2013 at 8:53
11
Solved
I've been trying to figure out how to map a set of characters in a string to another set similar to the tr function in Perl.
I found this site that shows equivalent functions in JS and Perl, but ...
Chickaree asked 23/5, 2012 at 19:33
5
Solved
How do I find the largest 10 files in a given directory, with Perl or Bash?
EDIT:
I need this to be recursive.
I only want to see large files, no large directories.
I need this to work on Mac OS...
3
On a standard linux set up, where can I add a directory to the @INC variable?
In the /etc/profile file, I added:
export PERLLIB=$PERLLIB:/foo/bar
export PERL5LIB=$PERL5LIB:/foo/bar
Thanks
10
Solved
Suppose I have a filehandle $fh. I can check its existence with -e $fh or its file size with -s $fh or a slew of additional information about the file. How can I get its last modified time stamp?
2
Is is possible to install and update Perl (CPAN) modules with universal (x86_64, arm64) architecture support? If yes, then how?
background
On an arm-based macOS computer, a Perl CPAN module can be ...
Disgusting asked 11/4, 2023 at 6:59
4
Solved
In case of Java, we can get the path separator using
System.getProperty("path.separator");
Is there a similar way in Perl? All I want to do is to find a dir, immediate sub directory.
Say I am b...
9
Solved
I understand one uses the "bless" keyword in Perl inside a class's "new" method:
sub new {
my $self = bless { };
return $self;
}
But what exactly is "bless" doing to that hash reference ?
Carnallite asked 24/12, 2008 at 19:48
3
Solved
The first print of the following code does not print the expected result although the subroutine is passed as the block argument. It is expected to print 1 but print's 2. What is the difference bet...
Plumy asked 10/4, 2023 at 21:56
7
Solved
I've installed the Template module via CPAN on my MacBook Pro and it seemed to install correctly.
But, when I try to run a script that includes the Template module, I get the following:
Can't loca...
Argilliferous asked 13/8, 2010 at 19:32
13
Solved
My co-workers complain that my Perl looks too much like C, which is natural since I program in C most of the time, and Perl just a bit. Here's my latest effort. I'm interest in Perl that is e...
Gratitude asked 10/4, 2009 at 20:56
2
Solved
What is the best way to ensure Perl uses the locale encoding (as in LANG=en_US.UTF-8) for STDIN/STDOUT/STDERR, without affecting file IO?
If I use
use open ':locale';
say "mañana";
open (my $f, '...
4
Solved
When there are too many matching files, shells like bash break if you include a glob pattern on the commandline like
perl -pi -e 's/hi/bye/' too_many_files*
You can work around this with xargs, gn...
2
Solved
I'm writing out a CSV file using Perl. The data going into the CSV contains Unicode characters. I'm using the following to write the CSV out:
open(my $fh, ">:utf8", "rpt-".$d...
3
I have been looking for some time now, and I decided to try some crowd sourcing.
I have searched (Googled) the answer and looked through Stack Overflow for some time now, and I cannot find a prope...
6
Solved
I know this kind of questions have been asked already many times before. The reason why I come here again is that I feel like I've missed something simple and fundamental.
Is it possible to make t...
Nuthouse asked 23/6, 2009 at 5:43
1
Solved
Where in the perl documentation does it mention when one will get exponential format here?
$ perl -wle 'print for 0.001, 0.0001, 0.00001, 1.00001;'
0.001
0.0001
1e-05
1.00001
No I am not talking a...
Heliport asked 18/3, 2023 at 0:37
3
Solved
I have a string in the following format:
\main\stream\foo.h\3
it may have more or less "sections", but will always end with a slash followed by an integer. Other examples include:
\main\stream2...
Viniculture asked 19/7, 2010 at 19:45
2
Solved
I am getting this error when running perl:
[Thu Mar 16 00:24:23 2023] list_directory_1.cgi: Subroutine
main::getcwd redefined at /usr/lib/cgi-bin/list_directory_1.cgi line
15.
I think it is comin...
Madelainemadeleine asked 16/3, 2023 at 0:42
2
I am trying to go back in time a little and play around with Perl once again. I have a Mac and VSCode installed and did the following:
brew install perl to install perl
this installs perl at /opt...
Ashleaashlee asked 9/8, 2022 at 11:1
3
I am running a Perl API that uses LWP::UserAgent to post form data to a file.
Occasionally I receive this error on large files:
"500 server closed connection without sending any data back&quo...
Capitalize asked 16/5, 2013 at 18:46
0
#!/usr/bin/env raku
use Inline::Perl5;
use Smart::Comments:from<Perl5>;
my $foo = 42;
### $foo
say "Done";
Expected output:
### $foo: 42
Done
Actual output:
Done
zsh: segmenta...
© 2022 - 2024 — McMap. All rights reserved.