Am I too much of a perl geek? Whenever I have to do a calculation I never ever fire up the calculator - I always use:
perl -le 'print ...'Wbat lengths do you go to to use perl for any given problem?
#!/usr/bin/perl
use XML::Twig;
my $MIRROR_DIR = "/web/mirror/infotree/xmltwig";
my $WEB_DIR = "mirlin:/web/infotree/";
my $version = $XML::Twig::VERSION; # can't get this from the shell!
my $tar = "XML-Twig-$version.tar.gz";
my $dev_text = "twig_dev.txt";
my $dev_html = "twig_dev.html";
my $readme = "XML-Twig-$version.README";
system "make clean; rm Twig.pm; perl speedup Twig.pm.slow > Twig.pm; perl Makefile.PL; make";
sleep 2;
system "touch Twig.pm.slow; make tardist";
system "pod2text Twig.pm > $dev_text; pod2html Twig.pm > $dev_html";
system "cp $tar $dev_text $dev_html Changes $MIRROR_DIR/";
system "cp README $MIRROR_DIR/$readme";
# this one pushes it one step forward!
system "perl -i -p -e's{updated: [^)]*}{ q{updated: } . scalar localtime()}e;' $MIRROR_DIR/index.html";
system "scp -r $MIRROR_DIR $WEB_DIR";
Like you, I do my calculations from the shell using Perl, but I at least turned the "perl -le 'print...'" into a shell alias to make it easier to type
Re:lazier
entropic on 2002-10-22T15:13:42
used to use solar calculator
then pen and paper
then xcalc
then perl -e 'print '
then just perl and typed on stdin
now bc
wish i knew about bc beforeRe:lazier
darobin on 2002-10-22T15:21:37
I've known about bc before, but somehow I can't wrap my head around it... I know, it's probably due to my stupidity as I can't say it looks that difficult.
Maybe I'm not good at simple things, maybe that's why I now work where I do.
Hmmmmmm...
My calculator is perl -de 1. Earlier this semester I had a bit of a disaster in software engineering class as I was sitting on the front row doing COCOMO calculations for the class and coming up with the wrong answer because I didn't understand the use of Perl's ** operator.
Unfortunately, I don't have a three-key shortcut to bring up dc on OS X yet...