I finally got around to writing a script to rename all my music files to the same convention. That being either <track>-<song>.mp3 or <song>.mp3 with no spaces (I prefer underscores instead) and all lowercase. I know, it looks so simple! But the problem is all those occasions where you have something like <track>_-_<SONG>_-_(<remix by>).mp3...
Read more »
Tags: file, perl, regexp, regular expression, rename
Posted in perl | No Comments »
This is just a handy script I use for renaming my music collection. It got to be too much trouble having the first letter of each word capitalised, getting new music with the names all in caps, or all in lowercase…so I decided to make everything lowercase and write a script to do it...
Read more »
Tags: find, lc, lowercase, perl, rename
Posted in perl | No Comments »
NAME Csvsql – use SQL queries to access information in CSV files DESCRIPTION csvsql enables you to access a CSV file as if it were a table in a database. This means you can use SQL queries, with each ’common seperated value’ as part of a column. Traditionally in order to access specific information...
Read more »
Tags: csvsql, database, man, manual, perl
Posted in csvsql | No Comments »
About CsvSQL Csvsql is a project I started for my BSc’s final year software project. It is written in Perl and can be used to access information in csv files in the same way you would access a table in a database. This means you can use SQL queries, with each common seperated value...
Read more »
Tags: csv, csvsql, database, perl
Posted in csvsql | No Comments »
Printing A String Printing a string in Perl couldn’t be easier, you simply use the print function. If you want to print a line in Perl you simple need to write the following: print "Hello World!"; Output: Hello World! Similarly you you print a variable as follows: my $string = "Hello World!"; print $string;...
Read more »
Tags: hello world, perl, print, printing, string
Posted in perl | No Comments »
Opening a file eading from a file in Perl is pretty simple. After all, the language is pretty much built around dealing with text. The first step is to open the file, in which case you just need to use the following: open(INFILE,"< myfile.txt") or die "Can't open file: $!"; In this statement we...
Read more »
Tags: files, perl, reading
Posted in perl | No Comments »
For loop The below will print “Hello!” 10 times: for ($i = 0; $i < 10 ; $i++){ print "Hello!\n"; } Output: Hello! Foreach loop For iterating through an array it can be handy to use a foreach loop. In the example below the foreach loop will access each variables in the array and...
Read more »
Tags: arrays, for, foreach, loops, perl
Posted in perl | No Comments »
Initialising or clearing an array To create a new array it is as simple as declaring it as shown below. This method can also be used to clear an existing array, though you will have to drop the my. my @array = (); Creating an array with predefined elements To create a new array...
Read more »
Tags: arrays, perl, push
Posted in perl | No Comments »