Perl: functions and arrays

While reading an interesting post about perl by my brother I found an useful thing for myself: if a function returns an array, it is possible to filter the output of the function by applying array index to it.

For instance, function localtime() returns an array of values and usually, when I needed to get only one of the values from the middle of the array, I needed to read the output of the function to the array and then extract the value with the index:

my @time = localtime();
my $hour = $time[2];

Now, when I know the way out I can use one line:

my $hour = (localtime())[2];

there only two things that I can tell about this: there is always something to learn and there is more than one way to do it :)

Writing and reading E-mails

I know that some companies have a kind a set of rules for employees regarding reading and writing e-mails at work. Most of the time these rules are to help employees be protected from e-mail trojans and to teach them to write good messages so they won\’t be ignored or filtered on the other side.

Few days ago I was asked to help with creating such a rule set and I wonder if anyone already has some ideas which can be included or if there is any place on the web where I can find something similar

Interview with Linus Torvalds

Found a very nice interview with Linus Torvalds here. One of the funny part I found was:

Q: What are some funny things that happened to you or, that you did, when making Linux?

Linus: “Really early on when I was making Linux, one of the things I was really doing was reading Internet news from the university computer. I was dialing up to the university, I usually got a busy signal, so I programed an auto dialer. It would dial and if it got a busy signal, it would wait a minute then redial. I wasn\’t using Linux full time yet but was still using it. By mistake, I auto dialed my hard disc and basically I overwrote the operating system with the dial strings. So I had to decide if I would reinstall the OS I was using or start using Linux full time. I said OK, that\’s a sign, I\’ll start using Linux full time.”

This reminds me of a good way of starting using Linux after you have been using something different for a long time. If you want to succeed and be fast in it – just erase whatever you have, put Linux and start using it :) It might be a bit hard for the first week/month, but after you will catch yourself at using Linux without even thinking of it :)