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

learn more… | top users | synonyms

2
votes
2answers
20 views

Perl 6: Grammar issues (simple defines)

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

Little script to Caesar shift strings

I wrote a little Perl script to Caesar shift strings. Usage: ...
0
votes
0answers
25 views

Perl script to find world-writable files in local directories only

Over at stackoverflow 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
27 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
72 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
53 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
44 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
2answers
65 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
32 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
114 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
181 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 ...
15
votes
3answers
453 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
41 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
72 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
56 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
208 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
94 views

Parsing text from reports

I want to parse some reports from multiple devices, reports looks like this: ...
7
votes
2answers
108 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
121 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
354 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
69 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
34 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
61 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
52 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
25 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
99 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 ...
1
vote
2answers
42 views

Review a filter by date method

Method that 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
65 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
136 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
165 views

Review a Python module i18n

To start, I am a developer Perl and Python. I am passionate and I love to write code. I discovered this site through stackoverflow and I think it's great. I love the code review, peer programming, ...
2
votes
2answers
74 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
3answers
63 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
78 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: ...
2
votes
1answer
107 views

Perl script to rename multiple files with vi(m)

I'm new to Perl, learning on my own. I've wrote many scripts (utilities) for myself but never posted them online. I would really appreciate any feedback on this script before I post it on a forum. ...
0
votes
2answers
70 views

Method refactoring in perl

I'm getting data to fill out an e-mail template, and I'm wondering if this method is too long. How could I refactor it? ...
2
votes
2answers
128 views

Perl mutiple children creation

My program will fork, launching $n children. When a child finishes, the parent will launch a new one, if we have more to launch. ...
0
votes
1answer
146 views

Search and replace on command line [closed]

Is there a tighter (less characters) way to use perl on the command line to search and replace text from STDIN than I've got here? The code below works. ...
0
votes
2answers
100 views

Comparing two arrrays

I have two arrays: first one is ip addresses from billing for blocking second is ip addresses from firewall - already blocked My task is, compare it, and if ip address new in billing list - block ...
1
vote
1answer
419 views

SpamAssassin spam analyzer script in PHP based on sa-learn command

I wrote a small script to analyse spam messages that are spam false negative; meaning that they are spam messages in nature but that happened to be in your INBOX folder because your spam filter failed ...
3
votes
1answer
55 views

What changes, if any, are required to make the following Perl eval bullet proof?

eval { # here is put some code that may throw exception 1; # Why is the "1;" here ? } or do { my $error = $@; # Handle error. }; Does the ...
2
votes
2answers
68 views

Trying to improve a working regex

I am extracting data from a text file. Some of the lines from which I want to extract the data consist of a text description with single spaces, followed by a multiple-space gap preceding four fields ...
1
vote
1answer
81 views

clean way to make array a 2d array

Looking for a cleaner (possibly one liner) way to write the following my $spec_2d = ( ); foreach ( @spec ) { $spec_2d[$_][0] = $spec[$_]; } @spec = @spec_2d; ...
0
votes
2answers
83 views

Cleaner way to write the following

What would be the most efficient way to write the following code in Perl: ...
0
votes
2answers
889 views

Perl script to rename files in a directory tree (Beginner looking for code review)

I'm taking a scipting language course with no prior scipting language or linux experience, though I've taken classes in VB, Java, and C++. Our first assignment is to write a script that will traverse ...
8
votes
1answer
287 views

I think my company are using an Antipattern. Can you help me identify it please?

I work in a Perl development team with 30 of my peers split across 7 or 8 Agile development teams. We employ code reviews as so forth but recently a weird new design pattern I'm going to refer to as ...
5
votes
2answers
226 views

Guess my Number in Perl

I have recently just started learning Perl, so I decided to program the classic 'Guess my Number' game. I was wondering if anyone can spot any areas for improvement, as it's my first program, I expect ...
2
votes
1answer
87 views

Code style: passing a reference to subroutine

Is the subroutine test1 ugly?/uglier than the others? ...
2
votes
2answers
59 views

Reading fields idiomatically

This technique is more general than just for config files which is why I'm not using Config::Any in this example. I have a config file with lines like this: ...
1
vote
1answer
81 views

Perl project review - Word counter

I wrote this perl script that analizes a text and plot out a bar graph of the word occurrences during the text. Since come mainly from Javascript and PHP, i would like to know how bad is this code ...
3
votes
1answer
92 views

Feedback on my Perl wrapper library (written using Moose) for a REST API

I wrote a wrapper library for a REST API (https://semantics3.com) in perl using the Moose library. I would like to gather some feedback on it (mainly on the oop part since I am new to moose), before ...