On Mon, 2008-10-13 at 12:15 -0400, Chas. Owens wrote:
> But You are typing more. If you were making the claim that
>
> {
> local @" = ", ";
> print "buy @a1\nsell @a2\nkeep @a3\n";
> }
>
> was easier to type than
>
> print
> "buy ", join(', ', @a1), "\n",
> "sell ", join(', ', @a2), "\n",
> "keep ", join(', ', @a3), "\n",
>
> I might agree with you, but even then I think I prefer the second. As
> it is you are typing more and it is more cryptic. I don't mind
> cryptic if it is more efficient in some way (speed, memory,
> characters, lines, etc), but your example is no better than the join
> example. There is no benefit to being cryptic there.
Programming is as much about communication and organization as it is
about coding. If typing becomes tedious, replace it with sub's:
sub comma_list {
return join( ', ', @_ );
}
sub show {
my $action = shift @_;
my $list = comma_list( @_ );
print "$action $list\n";
}
show( 'buy', @a1 );
show( 'sell', @a2 );
show( 'keep', @a3 );
--
Just my 0.00000002 million dollars worth,
Shawn
Linux is obsolete.
-- Andrew Tanenbaum
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/