Then, eduardo pops by my computer and says "Oh! You should be doing that with Perl and Tk!" And he promptly sat down at the computer beside me and started typing away (at about 75wpm, i might add).
About 15 minutes later, he said "here, look at this" and i watched in amazement as his quick prototype whipped my Java applet's butt, in about 10 lines of code!
After that, I was sold on Perl!
I do have some suggestions for your code - first, please use strict. I know you don't need it, but for the sake of those new to Perl, it's just a good thing to demonstrate. Second, I would opt for my $a = join('',@ARGV); or even my ($a) = @ARGV; instead of my $a = "@ARGV";, simply because enclosing an array in quotes is confusing, again, to those new to Perl. Newbies see code like that and wonder why code like this doesn't do what they think it will:
And last, this is a good candidate for the -l ( dash el, not dash one) flag:my $ref = { foo=>'bar' }; my $clone = "$ref";
(yes, please use warning too) -l appends a new line at the end of your output, so this allows you to drop having to print a new line at the end. Laziness ;)#!/usr/local/bin/perl -lw
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)
In reply to (jeffa) Re: Simple calculator
by jeffa
in thread Simple calculator
by Juerd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |