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
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-- 1
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]>
&g
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:
unc
Bart et al:
In keeping with Larry's design philosophy that the language should "not just
sit there -do something!" I agree that there should be a number of
vector/matrix manipulations available, performed in a psuedo-scalar context
(not in a loop). Just to name a few:
arithmetic ops +-*/
ceil
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 c
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
$pi=|3.14128
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 Aug
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 http://
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) { ... }
hashes and regexes, and the scripting aspect (no explicit, seperate compile
step).
Its not the ONLY language with these aspects, but its the only one I know of
with ALL of them. Also I like the feeling of community and in some respect,
rebellion.
Anyhow those are what distinguish Perl for me.
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. I'
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 "k
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
Duck & cover Nate- I sugested that weeks ago and the flames are just dying
down in my mailbox..
It'll be an interesting experiement in "community behavior" however. If your
proposal is widely acclaimed or even seriously considered, while mine was
summarily dismissed, then it may be safe to ass
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 explain
Shoot chop. and chomp. Unless you add unchop and unchomp. Parity issue. Like
a language with YES and no NO.
Just kill then both.
>From: Bryan C. Warnock <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: Michael G Schwern <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: Re: RFC 195 (v1) Ret
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 (@l)
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:
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
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, Fre
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, onl
23 matches
Mail list logo