Perl is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports.

learn more… | top users | synonyms

5
votes
1answer
42 views

Readability of this Perl script to generate HTML code

I'm writing some scripts for a project which need to be maintainable. Someone will be coming in and taking over after a while and I want it to be easy for them to understand what's going on. What it ...
2
votes
2answers
29 views

Creating two output files from two formatted files

I've been working on a project to take data from csv files, re-format it, and display it as charts. I'm working for a company over the summer and when I leave, I would like my code to be ...
5
votes
2answers
90 views

How easy is it to crack this encryption algorithm?

When I was about 13 or 14 years old, I was a little interested in cryptography (which is, after all, an interesting field). I learnt quite a lot since that time (it has been about 8 years since then), ...
3
votes
1answer
29 views

Perl script to check disk usage

I'm looking for input on the code itself and formatting/style. This script parses the output of df -h on a Linux server and emails the user if the usage percentage ...
4
votes
1answer
49 views

Simple password dictionary attack script

This is my simple Perl script implement password dictionary attacking, encryption algorithm SHA1 with different length. It takes 2 arguments as input: first argument is password dictionary file path, ...
6
votes
1answer
52 views

Canonicalizing a large set of addresses using many regex substitutions

I have a script that is standardizing a large amount of data in the database. The standardization involves applying over 500 regular expressions to the data. Here is some quick pseudocode: ...
2
votes
2answers
42 views

Determine if a path matches a pattern

I have been struggling with a regular expression involving path names. Immediately, this is a bit troublesome, owing to the embedded / in the pattern, but braces to the rescue. First the convention ...
2
votes
1answer
32 views

Check the hardrive performance of the particular process using a Perl script

I have written the following Perl script to monitor the hardrive performance of the particular process (say, for example, Chrome). ...
5
votes
3answers
66 views

Command line tools to format tables

I am a big fan of one-liners using sed awk perl and other tools. But there are that are ...
1
vote
1answer
65 views

Optimizing Perl script which looks for world-writable files

A script which scans a local filesystem and writes to a file a list of world-writable files found on the filesystem. I ran it on a server with a couple terabytes of storage; not all of it used. In ...
2
votes
0answers
37 views

Writing a log file with threads

Here are all the threads write the log file. I want to know if the below script is fine, if it needs any modifications, and whether I am utilising threads properly to execute this code fast. ...
4
votes
3answers
96 views

Clean way to get size of directory

I'm working on a Unix machine where I can't use more than vanilla Perl, and I'm using Perl5.8. This script exits with a 1 if the current directory size is smaller than 1 GB (the character after ...
0
votes
0answers
27 views

Proving a conjecture given a set of clauses - calculating complexity

I have written this Perl program to prove a conjecture given a set of clauses. I've actually posted some code from it on here in another question. This time its all done and I've made it as fast as ...
4
votes
4answers
284 views

Optimizing system calls and nested loops

I'm writing a Perl program to take a set of clauses and a conclusion literal and produce a resolution-refutation proof (if possible) using a breadth-first set of support (SOS) search algorithm. The ...
4
votes
2answers
76 views

Data screening using Perl

Background information I've been asked to write a little Perl script that allows genomic data to be screened against reference files in order to determine locations of specific mutations. The input ...
4
votes
0answers
60 views

Building hundreds of C++ components using multiple threads

I'm pretty new to Perl (and multithreading), so I was wondering if someone would be willing to take a look at my script and give me any tips on increasing performance. Motivation The script is ...
3
votes
1answer
40 views

Perl file sorting script

This is my first ever real 100% self made perl script, I'd like to know how I can improve it. ...
3
votes
2answers
54 views

Perl 6: Grammar issues (simple defines)

My goal is to parse defines in Objective-C code: ...
4
votes
1answer
43 views

Little script to Caesar shift strings

I wrote a little Perl script to Caesar shift strings. Usage: ...
3
votes
1answer
77 views

Finding world-writable files in local directories only

Over at Stack Overflow I asked how to scan a local filesystem ignoring all remote mount points. I only really wanted a push in the right direction and received it. After clacking away on my keyboard I ...
1
vote
0answers
49 views

Reliability of flock mutex (LOCK_EX|LOCK_NB)

I would like to test reliability of system flock in a multi-threaded and concurrent environment as some suggest that they are not reliable (in comments). Thus I ...
6
votes
2answers
80 views

Foreach-loop for and print commands

How can I make the following code shorter or efficient (maybe with other loops or other nice ideas), and keep the current functionality? ...
5
votes
1answer
139 views

Convert a mediawiki to dokuwiki script

I have quickly wrote a Perl script to convert a mediawiki to a dokuwiki. I know there's an existing script to make that, but I would have a simpler usage code and some use of the API from mediawiki. ...
3
votes
1answer
52 views

Reading a config file

I am relatively new to Perl and would like to check that the code I am writing docent have any major flaws in it or any bad practices. This is a fairly simple sub but one that gets used often. Seems ...
3
votes
1answer
74 views

Performance optimization in function for datastructure mapping

I want to optimize a Perl function which is frequently used in my application. The function creates a special datastructure from the results of ...
3
votes
1answer
48 views

Parsing psql output into multiple files

I wrote the following simple Perl script to read lines from stdin that are the output from a psql call that returns lines of the ...
13
votes
1answer
133 views

Regular backup/snapshots

A (long) while ago I set up a file server in my basement running Linux. I am OCD when it comes to backups. I set the server up with (remember, this was a while ago): disk for OS disk for 'valuable' ...
10
votes
3answers
228 views

Bowling calculator in Perl

A bowling score calculator is my go-to exercise for learning the basics of a language. I recently had to pick up Perl so I did this. I'm concerned that I'm doing subroutines wrong. I had a hard time ...
17
votes
3answers
804 views

Rainfall Problem

About a year ago when I was applying to jobs for the first time, I had an interview at a company and they posed the following problem to me, which I preceded to bomb. A year later I actually came up ...
4
votes
1answer
47 views

Data structure to RDF

I believe any data structure can be converted to RDF, and I wrote the subroutine below which sort of does this, at least for arbitrarily complex hashes. However, I'm unhappy with it because: ...
1
vote
1answer
128 views

TCPDUMP file (part of a real capture)

I have been working on this code for quite a while and just want to make sure it is up to good standards. I know many of you will have questions, so as they come up, I will edit my initial question to ...
4
votes
1answer
66 views

Find common preamble of a list of strings

Think of a set of text lines starting with a common string, e.g. indented code. ...
4
votes
2answers
426 views

Perl Code Improvements - reading CSV file

I am very new to Perl, but quite pleased with my short introduction to it! So, scenario is I have a number of text files (they are reports from a financial system) stored in a directory. Each report ...
3
votes
1answer
102 views

Parsing text from reports

I want to parse some reports from multiple devices, reports looks like this: ...
7
votes
2answers
109 views

Is the following a good C program for launching an interpreted script?

I was just wondering if this is a good example, following good practices, of a C program for launching an interpreted script from a native binary executable. Here the interpreter is Perl and the ...
1
vote
2answers
167 views

How do you “sordid sort” alphanumeric strings?

The question is about sorting alphanumeric string in a "more natural" order. Source: Marc LeBrun's "Sordid Sort" Computist Quiz Often a system string comparison sorts alphanumeric data ...
1
vote
1answer
460 views

More elegant way to get timestamp from day/hour? (Perl)

http://coolwx.com/buoydata/data/curr/all.html provides weather data from ships (or maybe buoys) at sea, but the date is given as "25/18" (meaning the 18th hour of the 25th day of the month, all ...
-1
votes
1answer
82 views

Extract SVG attribute properties [duplicate]

Can this code to parse the definitions of attributes of SVG elements be simplified within the constraints that this has to be a Perl/Windows/ActiveState solution? ...
0
votes
1answer
37 views

Perl Hash mapping SVG elements to their attributes [duplicate]

Is there a more reliable way of building a hash of the attributes associated with each SVG element? ...
0
votes
1answer
74 views

Perl hash mapping SVG elements to content elements

Is there a more reliable way of getting the content elements for each SVG element? ...
0
votes
1answer
56 views

Complex structure vs object

This is not, strictly speaking, code review, but I think my question can be asked here. This is a request to find out what seems to be the cleanest. This project is a blog engine that uses the file ...
0
votes
1answer
27 views

Highlight a pattern found

I made a small web application with a search box. I wanted to highlight the words found in the search. ...
1
vote
2answers
101 views

Optimization of a while-loop searching for words in a dictionary

This is my first question here. I'm using an open source program called MElt which lemmatize (give the lemma example:giving-->give) of words. MElt works on Linux and its programmed in Perl and ...
2
votes
2answers
55 views

Filter by date method

This method allows me to filter by date a data structure list of hash that contains articles. I would like to have your opinion on the code: ...
0
votes
0answers
71 views

Design object Perl

It is a small backend blog engine that uses the file system as a storage. But I have some ideas to improve things a bit, I'll add support for git and another thing. But I'd like to have an opinion in ...
3
votes
2answers
148 views

Perl script for generating iTunes xml Metadata for MP3 CDs/DVDs

Many years ago, I wrote a script in Perl that was meant to create a cached metadata of MP3 files (in Apple's plist/XML format) which iTunes uses when you insert a CD/DVD full of MP3 files (the same ...
7
votes
1answer
193 views

Simple text localization system

My first question relates to the first Python module that I published on Python. This is a very small and simple module, the package contains only one class. This is a port of a Perl module ...
2
votes
2answers
79 views

Advice on refactoring my Perl code

How should a refactor the script I’m writing? The script currently loops through an output line by line picking out elements of interest and adds them to a hash data structure. If a key already ...
0
votes
2answers
72 views

Structured instructions for simple extraction script

I have a rather simple task in trying to extract keywords from input.dat which looks like: ...
1
vote
3answers
80 views

How to improve the computation speed of my shell script/program?

I have written a shell script to process my huge data files (each one having around 7,000,000 lines ~ a weeks data in a single file). Below is the sample of my data file (i.e., input file) structure: ...