I tried to contribute on this list but it seems we've coalesced downto Tom
and a handful of others. No one else has a voice.
I have nothing but respect for Tom, Nathan, et al, but its no longer my idea
of a community - more like a faction. I'm getting more into PHP now and
less into Perl,
These would be perlish, nice, terse, succint, and economical:
my ($a, $b, $c) = 0;
@h(@colours)='red';
($i, $i, $k) += 2;
@nums = 10 * @nums;
.
.
.
Ed
_
Get Your Private,
Since there were no objections to cleaning up the error messages on
unbalanced parens and braces, can we RFC that request?
-Ed
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information
use diagnostics;
my $i=1;
print 'hi' if ($i=1;
running this with perl -wc (v 5.004, unix), I get
perl -wc x.pl
syntax error at x.pl line 3, near "1;"
x.pl had compilation errors (#1)
(F) The final summary message when a perl -c fails.
Uncaught exception from user code:
I really like
(do something) if (something is TRUE);
as opposed to
if (something is TRUE) {do something}
Just personal taste I guess, but to me the former is a nice Perlism.
So what about
(do something) foreach (some list);
i.e.
print foreach (@l);
as opposed to
foreach
The fact that something can be accomplished in Perl doesn't necessarily mean
its the best or most desirable way to do it. I respect the programming
abilities, but
grep { ref($a) eq ref($b) } @b)
is far less intuitive than the proposal. I could perhaps dig into my distant
memory and
Hey Raptor et al:
Wow you did some homework! Nice ideas, but the consensus seems to be "roll
your own". I've noted that opertors working on arrays are generally
discouraged in favor of scalar ops in these discussions, so for example your
(min,max) (ceiling, floor) are coded thousands of times
Making 0 the first element makes as much sense as 1- just a convention.
However there is precedence for letting the user decide. Does anyone else
remember
)ORIGIN 1
? So we establish a var $something=n where n is the array origin.
I don't think I'd ever use it personally, having been a c
Having just coded some more perl resplendent with this syntax:
$in{pmonth}=$usr{paidon};
$in{pmonth}=~s/^.+([A-Za-z]{3,3}).+$/$1/;
once again I'll suggest (then I quit)
$in{pmonth}=~s/^.+([A-Za-z]{3,3}).+$/$1/,$in{paidon};
is a LOT nicer, and more Perlish (see split) way of doing this.
Excellent idea- anything to get to production faster!
But don't {} or {1} sort of do the same thing?
From: Larry Wall [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: ... as a term
Date: Mon, 21 Aug 2000 09:09:01 -0700 (PDT)
Randal L. Schwartz writes:
: if ($a == $b) { ... } #
Is eq needed? Can't == be used for either context?
$a == 'cat'
is readily distinguishable from
$a == 2;
so the compiler should be able to determine context.
Get Your Private, Free E-mail from MSN Hotmail at
Sounds like a good idea. I propose a commandline arg that gives info about
modules in @INC also. I emailed this to the list earlier but it never seemed
to make it.
Something like
perl -M 'Digest'
might return:
/usr/local/lib/perl5/site_perl/:
-r--r--r-- 1 root other 4733
I agree that constants deserve a prominent place in Perl, as they offer
constaint which can be beneficial to programmers. Sometimes its nice to know
that I mistakenly tried to treat a static variable as dynamic.
I disagree with "const" as it's verbose; I'd rather see something like
I now you all will kill me for this but here goes..
this is slow:
foreach (keys %h)
{if (/some regex/) {$h2{$_}=$h{$_}}
}
In other words, extract a new hash from an existing one by searching for
primary keys matching a regex. (Please don't get off on your solutions to
this or syntax
Here is the argument-
Perl has (had?) chomp(). It removes \n at the end of a line. That's
something we often need to do. We ALSO often need to ADD \n to the end of a
line. This usually looks something like:
print "$kitty\n";
Hence my println() suggestion. Maybe instead it should be:
Short of writing a perlscript to do it, searching @INC for modules can be a
pain. How's about a switch that searches @INC for modules matching a regex
instead of executing anything (behaves like perl -v), so for example:
perl -M 'spook'
might return
/usr/local/lib/perl5:
-rw-r--r--
As long as were culling, might want to consider removing chomp() and
possibly chop(). The language provides other ways to accomplish those thru a
simple regex, and if the "println" suggestion I made was "too specific" then
certainly chomp() is as well.
Just a thought to chomp on..
E
I like this approach, in that it places the complexity outside of the loop.
Another generalized approach might be a new $ var which turns autochomp off
and on for all fh's (are there any $'s left? :D ).
Cheers,
Ed
From: Jonathan Scott Duff [EMAIL PROTECTED]
To: Ed Mills [EMAIL PROTECTED
I actually saw this in the newsgroups and thought it was a neat idea. What
about
println $textvar;
instead of
print "$textvar\n";
Ever so much easier to read and write, prints the arg and appends \n.
Thank-You for consideration, great ideas I'm seeing here!
-Ed
19 matches
Mail list logo