Top "Perl" questions

Perl is a procedural, high-level, general-purpose, dynamic programming language, known for its native support of regular expressions and string parsing capabilities.

In Perl, how can I concisely check if a $variable is defined and contains a non zero length string?

I currently use the following Perl to check if a variable is defined and contains text. I have to check …

perl string
Escaping a forward slash in a regular expression

My question is a simple one, and it is about regular expression escaping. Do you have to escape a forward …

regex perl escaping
How do I get the full path to a Perl script that is executing?

I have Perl script and need to determine the full path and filename of the script during execution. I discovered …

perl path location
In Perl, how can I read an entire file into a string?

I'm trying to open an .html file as one big long string. This is what I've got: open(FILE, 'index.…

string perl slurp
How can I check if a Perl module is installed on my system from the command line?

I tried to check if XML::Simple is installed in my system or not. perl -e 'while (<@INC>) { …

perl command-line perl-module
How do I configure Apache 2 to run Perl CGI scripts?

I would like to configure Apache 2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps that I …

linux perl apache cgi
How can I quickly sum all numbers in a file?

I have a file which contains several thousand numbers, each on it's own line: 34 42 11 6 2 99 ... I'm looking to write a script …

linux perl bash shell awk
What is the best way to delete a value from an array in Perl?

The array has lots of data and I need to delete two elements. Below is the code snippet I am …

arrays perl
Match whitespace but not newlines

I sometimes want to match whitespace but not newline. So far I've been resorting to [ \t]. Is there a less …

regex perl