Lightning flashed, thunder crashed and Nathan Wiger [EMAIL PROTECTED] whisper
ed:
| I suggest a modification to this RFC: if chomp() is called without args,
| it modifies $_ directly, consistent with its current implementation.
| That way you can write:
If it is called without args, it really is
Bart Lateur wrote:
chomp() is basically just a "postprocess data coming from a file"
command.
That is way too simplistic. I for one think the current behavior
of chomp() is ideal for its simplicity.
while() {
/foo/ and next; # why bother chomping?
On Wed, 9 Aug 2000 09:23:02 -0400, John Porter wrote:
That is way too simplistic. I for one think the current behavior
of chomp() is ideal for its simplicity.
while() {
/foo/ and next; # why bother chomping?
if ( /bar/ ) {
print; #
On Wed, 09 Aug 2000, Brust, Corwin wrote:
So, kids, whatcha doing with that return value? (the number of characters
removed by the operation)?
Store it (in paragraph mode) so I know how many \n's to append back on
when spitting the output back. (Provided that matters. Otherwise, I
just
Thus it was written in the epistle of Segher Boessenkool,
The magic defined($_ = FILE) only happens if FILE is the only thing
inside while().
In this case, it's not (there's a chomp() inside as well), so the magic
doesn't apply.
Ok. One more time . . .
I'm proposing that we change
Ted Ashton writes:
: Thus it was written in the epistle of Segher Boessenkool,
:
: The magic defined($_ = FILE) only happens if FILE is the only thing
: inside while().
:
: In this case, it's not (there's a chomp() inside as well), so the magic
: doesn't apply.
:
: Ok. One more time . .
Larry Wall writes:
: (Note that under Unicode, we might well have one line terminated with a
: line separator, and the next line terminated with a page separator, and
Make that paragraph separator.
Larry
At 10:12 AM 8/8/00 -0700, Larry Wall wrote:
Ted Ashton writes:
: Thus it was written in the epistle of Segher Boessenkool,
:
: The magic defined($_ = FILE) only happens if FILE is the only thing
: inside while().
:
: In this case, it's not (there's a chomp() inside as well), so the magic
:
"LW" == Larry Wall [EMAIL PROTECTED] writes:
LW Before we get too carried away discussing the syntax of chomp,
LW let's look a bit at the semantics. What's chomp supposed to work
LW on if we make $/ go away? I think any discussion of chomp without
LW considering how the input
On Tue, Aug 08, 2000 at 01:56:12PM -0400, Uri Guttman wrote:
a couple of ideas. one, i proposed we keep a global $/ and $\ for
default use by handles which haven't set their own.
Rather than having global $/ and $\, each filehandle has their's
defaulted to something reasonable.
two, instead
Thus it was written in the epistle of Jonathan Scott Duff,
On Tue, Aug 08, 2000 at 01:56:12PM -0400, Uri Guttman wrote:
a couple of ideas. one, i proposed we keep a global $/ and $\ for
default use by handles which haven't set their own.
Rather than having global $/ and $\, each
On Tue, Aug 08, 2000 at 02:16:57PM -0400, Ted Ashton wrote:
I, for one, would like to know where the assumption came from that there would
be no default filehandle.
I believe Larry said he was probably going to axe it.
Is it necessary that instead of typing
print 'Hello World.';
"TA" == Ted Ashton [EMAIL PROTECTED] writes:
TA Thus it was written in the epistle of Jonathan Scott Duff,
On Tue, Aug 08, 2000 at 01:56:12PM -0400, Uri Guttman wrote: a
couple of ideas. one, i proposed we keep a global $/ and $\ for
default use by handles which haven't set their
From: Ted Ashton [mailto:[EMAIL PROTECTED]]
I don't particularly mind the last two - in fact they add some benefits
(like not modifying the original), which are nice to have. However, that
first one, frankly, drives me nuts.
Please reread the proposal. chomp() called in void context
At 02:29 PM 8/8/00 -0400, Michael Mathews wrote:
Dan Sugalski said:
Which brings up the questions:
* What about scalars that didn't come from filehandles?
* Should the chomp function use the filehandle's current separator, or the
one in effect when it was read?
* Do we even want to
Thus it was written in the epistle of Brust, Corwin,
From: Ted Ashton [mailto:[EMAIL PROTECTED]]
I don't particularly mind the last two - in fact they add some benefits
(like not modifying the original), which are nice to have. However, that
first one, frankly, drives me nuts.
Please
"MM" == Michael Mathews [EMAIL PROTECTED] writes:
What about a chomp($foo, '\r\n'); # or chomp(FH, '\r\n');
syntax.
Looks an awful lot like: s/\r\n//; to me...
MM Yep. It should-- that's all chomp does afterall. The difference is
MM that the proposed chomp should be smarter
Thus it was written in the epistle of Uri Guttman,
if a ref to a scalar, it chomps in place. return the ref? the chomped
char count?
. . . the point of the RFC was to propose making chomp()'s behaviour change
depending on context.
Here's the summary so far as I can tell:
One-argument
On Tue, 8 Aug 2000, Ted Ashton wrote:
Quite true. The two-argument one is new to me and I hadn't thought much
about it. Do you have a suggestion?
Hmm,
chomp { /\r\n/ } @chomp_me;
ala p5 map, grep, and sort?
--
Mike Pastore
[EMAIL PROTECTED]
On Tue, 8 Aug 2000 10:12:49 -0700 (PDT), Larry Wall wrote:
If chomp exists in Perl 6 at all, I think it would
have to be some kind of method call on the string that figures out what
the discipline determined to be the terminator *for the current line*.
(Note that under Unicode, we might well
On Tue, 8 Aug 2000, Bart Lateur wrote:
All you'd have to do, is set a boolean flag on the "filehandle object",
saying: "Oi, I want this chomped.". For example:
$fh-chomped(1);
Then, what $fh would do, is read one line, looking for whatever line
end it accepts, finish where found,
On Tue, 8 Aug 2000 18:35:46 -0400, Michael Mathews wrote:
I frequently use chomp in ways that have nothing to do with "reading from
files" and I would bet this is true for everyone here too. For example:
use CGI;
$cgi = new CGI;
$foo = $cgi-param('foo');
#as part of doing stuff to the user
On Tue, 8 Aug 2000, Michael Mathews wrote:
Ted Ashton said:
Thus it was written in the epistle of Uri Guttman,
how do you tell the above two apart? by array do you mean only an array
variable? then you can't chomp a list of scalar values or multiple
arrays, etc.
this needs
Ted Ashton said:
Thus it was written in the epistle of Uri Guttman,
how do you tell the above two apart? by array do you mean only an array
variable? then you can't chomp a list of scalar values or multiple
arrays, etc.
this needs to be clarified.
Quite true. The two-argument one
Michael Mathews wrote:
Like "join" the order of arguments would have to be "chomp($thing_to_remove,
@array)" but this spoils the default behavior of $thing_to_remove being
optional...
unless you think we should require arrays to be passed by reference.
Well, if we were really talking
On 7 Aug 2000 16:06:44 -, Perl6 RFC Librarian wrote:
This RFC contains two proposed changes. First, as it is common to want to
removed newlines upon reading a file,
while (chomp(FILEHANDLE)) {
. . .
}
should become the equivalent of
while (FILEHANDLE) {
chomp;
. . .
Thus it was written in the epistle of Bart Lateur,
On 7 Aug 2000 16:06:44 -, Perl6 RFC Librarian wrote:
This RFC contains two proposed changes. First, as it is common to want to
removed newlines upon reading a file,
while (chomp(FILEHANDLE)) {
. . .
}
should become the
27 matches
Mail list logo