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.

What is the difference between 'my' and 'our' in Perl?

I know what my is in Perl. It defines a variable that exists only in the scope of the block …

perl scope
How should I do integer division in Perl?

What is a good way to always do integer division in Perl? For example, I want: real / int = int int / …

perl integer-division
How do I sleep for a millisecond in Perl?

How do I sleep for shorter than a second in Perl?

perl sleep
How do I update all my CPAN modules to their latest versions?

How do I update all my CPAN modules to their latest versions?

perl cpan
Automatically get loop index in foreach loop in Perl

If I have the following array in Perl: @x = qw(a b c); and I iterate over it with foreach, …

perl foreach
In Perl, how to remove ^M from a file?

I have a script that is appending new fields to an existing CSV, however ^M characters are appearing at the …

perl carriage-return hidden-characters
Neatest way to remove linebreaks in Perl

I'm maintaining a script that can get its input from various sources, and works on it per line. Depending on …

perl line-breaks
How can I store the result of a system command in a Perl variable?

$ cat test.pl my $pid = 5892; my $not = system("top -H -p $pid -n 1 | grep myprocess | wc -l"); print "not = $not\…

perl command system
How to use a variable in the replacement side of the Perl substitution operator?

I would like to do the following: $find="start (.*) end"; $replace="foo \1 bar"; $var = "start middle end"; $var =~ s/$find/$…

regex perl substitution
How can I delete a newline if it is the last character in a file?

I have some files that I'd like to delete the last newline if it is the last character in a …

linux perl shell awk sed