What exactly does Perl’s “bless” do?

In general, bless associates an object with a class. package MyClass; my $object = { }; bless $object, “MyClass”; Now when you invoke a method on $object, Perl know which package to search for the method. If the second argument is omitted, as in your example, the current package/class is used. For the sake of … Read more

Seeking clarification on apparent contradictions regarding weakly typed languages

UPDATE: This question was the subject of my blog on the 15th of October, 2012. Thanks for the great question! What does it really mean for a language to be “weakly typed”? It means “this language uses a type system that I find distasteful”. A “strongly typed” language by contrast is a language with a … Read more

Rename Files and Directories (Add Prefix)

Thanks to Peter van der Heijden, here’s one that’ll work for filenames with spaces in them: for f in * ; do mv — “$f” “PRE_$f” ; done (“–” is needed to succeed with files that begin with dashes, whose names would otherwise be interpreted as switches for the mv command)