Posts Tagged ‘Perl’
Mmmm rubygems (0)
I put together my first ruby gem today (for internal use at work). Here is a good tutorial on how to do it. Or else look at chapter 17 in the Pickaxe book. Simply make a gemspec file, define a few attributes listing and describing your files and then compile it. […]
Vim brute force (0)
In the end all code ends up as machine language. Generally the way to write effective code is to use a high-level language and let a smart compiler expand a tiny bit of high-level code it into a great deal of low-level machine language.
But another way I seem to end up doing this is […]
Unique-ify lines in Vim (0)
If I want to get rid of duplicate lines in a text file, in Linux I can simply pipe it through uniq. Windows doesn’t have an equivalent (or else I don’t know about it). There may be a Vim equivalent also, but I don’t know it if there is. Instead you can […]
Perl vs. Ruby breaking from nested loops (3)
Breaking out of nested blocks is apparently done much differently in Perl and Ruby. In Perl if you run this:
my $counter = 0;
foreach my $outer (1..5) {
foreach my $inner (’A’..’E') {
print "$outer: $inner\n";
last if […]
One-liner explained (1)
Someone asked for an explanation of my obfuscation, so here goes:
The -l flag to Perl makes it stick a newline on the end of output. Handy.
Reformatted and indented, the code would be
for(0..0xb271a1){
++( $} ||= q|A|)
}
( $; = q;"\x70\x72\x69\x6e\x74\x24\x7d"; ) =~ s;.*;$&;eee
A good obfuscation technique is to use odd characters […]
One-liner (1)
Been a while since I perl’ed.
perl -le ‘for(0..0xb271a1){++($}||=q|A|)}($;=q;"\x70\x72\x69\x6e\x74\x24\x7d";)=~s;.*;$&;eee’
RubyFacets (0)
Today I found a really neat site, RubyFacets. Reminds me a bit of Perl’s List::Util and List::MoreUtils; it’s a bunch of methods to extend core classes in interesting ways.
A while back I posted about a way to prevent Ruby from raising an exception when trying to access an un-initialized subarray of a multidimensional array […]
Lisp, part 2 (0)
Everyone I know who does Lisp says “Learn Lisp and it will change how you look at all other programming languages!” I don’t know if that’s true or not, but I think I’m starting to learn a bit.
Thank you, Google groups (0)
I just had a nasty run-in with PAR. Activestate Perl doesn’t play as nicely with CPAN as I’d like, so I usually use its own built-in “Perl Package Manager”. The problem with that is that installed packages aren’t rebuilt (from what I can tell), they’re just downloaded in binary form and unpacked. […]
Ruby > Perl (0)
A while back I stopped coding in Perl and starting using Ruby for mostly everything. Today I had occassion to use Perl again, because there’s no good working equivalent to Perl’s Spreadsheet::WriteExcel that works well in Ruby; this Ruby spreadsheet package is a bit too buggy. (It’s not my choice to use […]
