Calculations


\"PerlThis is the third part of a seven-part article on famous Perl one-liners. In this part I will create various one-liners for calculations. See part one for introduction of the series.

Famous Perl one-liners is my attempt to create “perl1line.txt” that is similar to “awk1line.txt” and “sed1line.txt” that have been so popular among Awk and Sed programmers.

The article on famous Perl one-liners will consist of at least seven parts:

  • Part I: File spacing.
  • Part II: Line numbering.
  • Part III: Calculations (this part).
  • Part IV: String creation. Array creation.
  • Part V: Text conversion and substitution.
  • Part VI: Selective printing and deleting of certain lines.
  • Part VII: Release of perl1line.txt.

After I’m done explaining all these one-liners, I’ll publish an ebook. Everyone who’s subscribed to my blog will get a free copy! Subscribe now!

The one-liners will make heavy use of Perl special variables. A few years ago I compiled all the Perl special variables in a single file and called it Perl special variable cheat-sheet. Even tho it’s mostly copied out of perldoc perlvar, it’s still handy to have in front of you, so print it.

Read more…………

URL: http://feedproxy.google.com/~r/catonmat/~3/KqbejYcmAtQ/
\"Reblog

No sound on Fedora 11 Leonidas – resolved.

I have been trying to get the sound working on the F11 install that I had. Searched all the sites and blogs I could find. Nothing seemed to be working.

Finally I did a

alsactl init

and WOW, I have got my sound. Worht a try if you too are having issues with sound.

Access the disk image created by Qemu using guestfish in Fedora.

If you are used to using Qemu for doing some experiments with different distro\’s then you would also understand the problem of having to do ftp/ssh to copy the files from virtual machine to local machine. Also you have to run the machine to do that. How would you like to have a application that can help you copy the files to and from the  image without having to run the VM. That\’s exactly what the guestfish does. How to do it, quick demo here:

sudo yum install guestfish

Now once installed you can run guestfish by typing guestfish. Extensive help is available with help command so I am just giving pointers here to get you started:

First add the drive image with

add-drive <image name>

Start a qemu sub-process inside guestfish

launch

Now mount the drive using

mount /dev/sda1 /

you can list the devices using

list-devices

Now you can use upload, download, ls, mkdir, cat et. al. See help for more details.