Questions tagged [perl]

Perl is a procedural, high-level, general-purpose, dynamic programming language, known for its native support of regular expressions and string parsing capabilities. Please use this tag for questions about Perl in general. For things related to the new (but related) language Raku (formerly "Perl 6"), please use the raku tag. For Perl-style regular expressions in other languages, use the regex tag, or, if they are based on the PCRE library, the pcre tag.

Perl is a highly capable, feature-rich programming language with over 25 years of development. Perl runs on over 100 platforms from portables to mainframes and is suitable for both rapid prototyping and large-scale development projects.

Perl can also refer to a family of high-level, general-purpose, interpreted, dynamic programming languages. The languages in this family include Perl and Raku (formerly known as Perl 6). For Raku-related questions, please use the tag . For "Perl-style" regular expressions in other languages, often based on the PCRE library, do not use tag , but tag or a more specific tag such as tag .

Related Resources

Perl-related Blogs and Bloggers

Free Perl Programming Books

Perl Programming Books

Related tags

Date & Time

Libraries for working with dates and times

Devices

Libraries to talk to physical devices

DevOps Tools

Libraries that help when you want to deploy software across networks on several hosts that are working across computer networks

  • Rex - Remote Execution

FAQs

Frequently ask questions

More information

67820 questions
13
votes
1 answer

How to get the type of the reference?

Is there any function available in Perl to check the reference type: my $ref=\@array; I need to get the reference type as array by the function.
karthi_ms
  • 5,568
  • 11
  • 38
  • 39
13
votes
2 answers

Can I force LWP::UserAgent to accept an expired SSL certificate?

I would like to know whether it is possible to force LWP::UserAgent to accept an expired SSL certificate for a single, well-known server. The issue is slightly complicated by the Squid proxy in between. I went as far as to set up a debugging…
fB.
  • 358
  • 1
  • 2
  • 10
13
votes
1 answer

Notepad++ regex replace named groups

I try replace author Full name with article title I have a list of articles, similar like this: Albershein P., Nevis D. J. A method for analysis of sugars in plant cell wall polysaccharides by gasliquid chromatography // J. Carbohydrate Research.…
Victor Dronov
  • 139
  • 1
  • 12
13
votes
5 answers

ruby interview question

I got this question in a previous interview and couldnt do it , any idea? What does this do: `$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=( $!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;…
fenec
  • 5,637
  • 10
  • 56
  • 82
13
votes
6 answers

Is there any Java Library to operate on unix config files like http.conf

There are very good Perl libraries (e.g. Apache::Admin::Config) to operate on traditional unix config files like httpd.conf. Anyone know if there is good Java libraries to do the similar task? I know there is a c library called Augeas with Java…
Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
13
votes
5 answers

How do you check the success of open (file) in Perl?

The following (not very Perl-ish) code #!/usr/bin/perl if (! -e "mydir/") { print "directory doesn't exist.\n"; } open (my $fh, ">", "mydir/file.txt"); if ($fh) { print "file opened.\n"; print $fh; print $fh "some text\n" or die "failed to…
Rhubbarb
  • 4,248
  • 6
  • 36
  • 40
13
votes
1 answer

What does `sub bar { +{$_[1] => $_[2]} }` exactly do?

I don't understand the + sugar sign in this example taken somewhere while goggling: sub bar { +{$_[1] => $_[2]} } I wrote this and I don't see any differences here: use Data::Dumper; # Not any differences here my $foo = {value => 55}; my $bar =…
nowox
  • 25,978
  • 39
  • 143
  • 293
13
votes
1 answer

How many substitutions took place in a Perl s///g?

Small example: perl -e '$s="aaabbcc";$c=()=$s=~/a/g;print"$c\n$s\n"' (m//g) outputs 3 aaabbcc whereas perl -e '$s="aaabbcc";$c=()=$s=~s/a/x/g;print"$c\n$s\n"' (s///g) outputs 1 xxxbbcc I'd like to do both things at once without having to match…
musiKk
  • 14,751
  • 4
  • 55
  • 82
13
votes
7 answers

ActivePerl Installation on Windows operating system

I have installed ActivePerl on my Windows OS. I have followed below URL procedure to install ActivePerl Installation After having done that, I have tried to run "perl -v " on the command line. But it reports the following error. The system cannot…
Pavunkumar
  • 5,147
  • 14
  • 43
  • 69
13
votes
2 answers

What is the meaning of qr// in perl

I am completely new to perl and trying to design a lexer where I have come across: my @token_def = ( [Whitespace => qr{\s+}, 1], [Comment => qr{#.*\n?$}m, 1], ); and even after going through multiple sites I did not…
bansal
  • 227
  • 1
  • 3
  • 9
13
votes
3 answers

Fixing a file consisting of both UTF-8 and Windows-1252

I have an application that produces a UTF-8 file, but some of the contents are incorrectly encoded. Some of the characters are encoded as iso-8859-1 aka iso-latin-1 or cp1252 aka Windows-1252. Is there a way of recovering the original text?
ikegami
  • 367,544
  • 15
  • 269
  • 518
13
votes
3 answers

What does it mean when you try to print an array or hash using Perl and you get, Array(0xd3888)?

What does it mean when you try to print an array or hash and you see the following; Array(0xd3888) or HASH(0xd3978)? EXAMPLE CODE my @data = ( ['1_TEST','1_T','1_TESTER'], ['2_TEST','2_T','2_TESTER'], ['3_TEST','3_T','3_TESTER'], …
Luke
  • 327
  • 2
  • 7
  • 15
13
votes
4 answers

How can I run Perl system commands in the background?

#!/usr/bin/env perl use warnings; use strict; use 5.012; use IPC::System::Simple qw(system); system( 'xterm', '-geometry', '80x25-5-5', '-bg', 'green', '&' ); say "Hello"; say "World"; I tried this to run the xterm-command in the background, but…
sid_com
  • 24,137
  • 26
  • 96
  • 187
13
votes
7 answers

What is Perl's secret of getting small code do so much?

I've seen many (code-golf) Perl programs out there and even if I can't read them (Don't know Perl) I wonder how you can manage to get such a small bit of code to do what would take 20 lines in some other programming language. What is the secret of…
sak
  • 147
  • 3
13
votes
3 answers

What exactly are "$a" and "$b" in Perl's "sort()" function?

I understand how to get the results I want from using Perl's sort() function, this is more a question about the inner workings of sort(). Where do the "$a" and "$b" variables come from? I read through the documentation for sort and it seems…
tjwrona1992
  • 8,614
  • 8
  • 35
  • 98
1 2 3
99
100