Perl Padre IDE
Blogs20142014-02-21
Perl Padre IDE, Catalyst, and others
Perl is good at text processing, the following are some examples:
1. Add space between words
my $text = "ThisTextWithoutSpaces";
$text =~ s/([a-z])([A-Z])/$1 $2/g;
print $text; # This Text Without Spaces2. Get the size of a file in bytes
$size = -s “path/to/file.txt”;
3.Running Windows? Got a file with UNIX line endings?
perl -ne "s/n/rn/; print;" linux.txt > windows.txt
# This changes 'n' to 'tn', like tr "n" "rn" 4. Want to make a table of the number of times each word in $text appears?
my %words = ();
$words{lc($_)}++ for $text =~ /b([w']+)b/g;Each key of the %words hash will be a word in $text, and the value is the number of times that word appeared.
5. Padre, the Perl IDE
Padre is a Perl IDE, an integrated development environment, the url is http://padre.perlide.org/.
After install Padre which also install Perl latest version (5.14), then install Catalyst, the Perl MVC framework:
$ cpanm Catalyst::Devel