[Ilugc] randtype in perl

  • From: lug@xxxxxxxxxxxxxxxxxx (Chandrashekar Babu)
  • Date: Fri Jul 30 22:02:04 2010

Hi,

A better version as below (manages to type in random periods):

#!/usr/bin/env perl
# Save as randtype.pl
use Time::HiRes qw(usleep);
$| = 1 and usleep(rand()*150000) and print for (split //, join("",<>));

Run as below:
perl randtype.pl /etc/passwd OR
dmesg | perl randtype.pl

The one-liner version could be as below (run at the shell prompt):
dmesg | perl -MTime::HiRes -e '$| = 1 and Time::HiRes::usleep(rand()*150000)
and print for (split //, join("",<>));'

Cheers,
Chandrashekar.

-- 
Chandrashekar Babu.,
Independent FOSS Technologist and Corporate Trainer.,
http://www.chandrashekar.info/
+91-9884386075, +91-9543019934,
+91-44-32216664

Other related posts: