[19839] in Perl-Users-Digest
Perl-Users Digest, Issue: 2034 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 30 03:05:34 2001
Date: Tue, 30 Oct 2001 00:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1004429109-v10-i2034@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 30 Oct 2001 Volume: 10 Number: 2034
Today's topics:
Re: Can perl fill-in a web form without submitting it? <spam@thecouch.homeip.net>
Re: Can perl fill-in a web form without submitting it? <tony_curtis32@yahoo.com>
challenge, how short can you make this? <invalid@mctech.org>
Re: challenge, how short can you make this? <uri@stemsystems.com>
Re: challenge, how short can you make this? <wuerz@yahoo.com>
Re: challenge, how short can you make this? (John J. Trammell)
Re: challenge, how short can you make this? (Tad McClellan)
Re: challenge, how short can you make this? <bernard.el-hagin@lido-tech.net>
Re: challenge, how short can you make this? <bernard.el-hagin@lido-tech.net>
Re: Control M's still there? - how to make sure? (Tad McClellan)
filter data (venus)
Re: filter data (Chris Fedde)
Overloading subroutine in package main:: (PerlBeginner)
Re: Overloading subroutine in package main:: (Chris Fedde)
Re: Perl from NT OS to Linux/Unix (Chris Fedde)
print out the difference between two arrays (Tim)
Re: print out the difference between two arrays <jurgenex@hotmail.com>
Private instance variables in Objects ?? (Real Newbie)
Re: selecting lines for single spacing <hugo@fractalgraphics.com.au>
Re: What's wrong with File::Find <dan@tuatha.sidhe.org>
Re: What's wrong with File::Find <nospam-abuse@ilyaz.org>
Win32 port of PerlTK <mika.morell@no-spam-what-so-ever.se.abb.com>
Win32 port of PerlTK <mika.morell@no-spam-what-so-ever.se.abb.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 29 Oct 2001 21:15:45 -0500
From: "Mina Naguib" <spam@thecouch.homeip.net>
Subject: Re: Can perl fill-in a web form without submitting it?
Message-Id: <d3oD7.6052$NY2.497171@wagner.videotron.net>
"Qunfeng Dong" <qfdong@iastate.edu> wrote in message
news:9rklnb$o5l$1@news.iastate.edu...
> Hi Guys,
>
> Thanks so much for answering my web form question. I guess I didn't make
> my question clear. I will try it just one more time.
>
> I want to write a CGI script to create a web form (I know how to do
> this), collect some text info input from users. Then use the collected
> info to partially fill out another static web form at another website
> (How do I do that?). This lets users look at the partially filled-out
> (by my script) form and fill out the rest of the static web form.
When you send the user an html <input> tag simply set it's "value" parameter
to what you want it to be.
for example
<input type=text name=firstname value="John">
If you're using the CGI.pm module, I'm sure it provides functionality to set
the "value" at the time you ask it to generate an "input" tag, otherwise, a
simple print() using something similar to the above example will do the
trick.
>
> Thanks again!
>
> Qunfeng
> --
> Qunfeng Dong
> qfdong@iastate.edu
------------------------------
Date: Mon, 29 Oct 2001 20:23:32 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Can perl fill-in a web form without submitting it?
Message-Id: <871yjlj26z.fsf@limey.hpcc.uh.edu>
>> On 29 Oct 2001 22:37:31 GMT,
>> qfdong@iastate.edu (Qunfeng Dong) said:
> I want to write a CGI script to create a web form (I
> know how to do this), collect some text info input from
> users. Then use the collected info to partially fill out
> another static web form at another website (How do I do
> that?). This lets users look at the partially filled-out
> (by my script) form and fill out the rest of the static
> web form.
If you want perl to act like a browser and transmit data
that could have come from a <FORM> to a remote server for
processing, then investigate LWP, e.g.
perldoc lwpcook
is the "cookbook" for using LWP. Bundle::LWP through CPAN
installs the whole (and 'kit 'caboodle). Whoops, wrong
language :-)
hth
t
--
Oh! I've said too much. Smithers, use the amnesia ray.
------------------------------
Date: Mon, 29 Oct 2001 23:13:31 -0500
From: mc <invalid@mctech.org>
Subject: challenge, how short can you make this?
Message-Id: <3BDE28EB.7048A0BE@mctech.org>
Here's a challenge for those who like to boil scripts down to their
lowest common denominator so to speak ....
A script [segment] to do the following ...
input: $_ = "34 - 39 , 41 , 44";
output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
input may contain any number of , separated elements, any of which may
be either a single number (41), or a range (34 - 39). elements may or
may not appear in numerical order. Output should be either in order of
occurance, or in sorted numerical order. comas and - may or may not have
spaces around them.
below is my original code, which ive since boiled down to an extreme
[censored] characters. (sorry, you'll have to wait <G>)
-----8<----------8<----------8<----------8<-----
$_ = "34 - 39 , 41 , 44"; # not included in character count
@s = split(/\s*,\s*/,$_);
foreach $e (@s) {
if ( $e=~/-/ ) {
($s, $e) = split(/\s*-\s*/,$e);
for ($i=$s;$i<=$e;$i++) { push @e, $i };
} else {
push @e, $e;
};
};
foreach (@e) { print "[$_]\n" }; # print not part of specs
-----8<----------8<----------8<----------8<-----
formatting whitespace does not count toward length.
how small can ya make it?
--
__ _ ____
/ ' \/ __/ http://mctech.org/
/_/_/_/\__/ http://pchelpers.org/
---------------------------------------------------------------------
My email address(s) are my private property. They are NOT to be used
or recorded for ANY reason without my explicit permission. Disregard
of this statement is in violation of federal privacy & copyright law.
---------------------------------------------------------------------
"He who would trade an ounce of freedom for a pound of security loses
both and deserves neither." ..Benjamin Franklin..
---------------------------------------------------------------------
The World Trade Center II will rise from the flames and ashes of the
original. Just like the PHOENIX of legend, The WTC2 will rise again.
------------------------------
Date: Tue, 30 Oct 2001 04:29:30 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: challenge, how short can you make this?
Message-Id: <x7d735yckl.fsf@home.sysarch.com>
>>>>> "m" == mc <invalid@mctech.org> writes:
m> Here's a challenge for those who like to boil scripts down to their
m> lowest common denominator so to speak ....
it is called perl golf.
m> input: $_ = "34 - 39 , 41 , 44";
m> output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
m> input may contain any number of , separated elements, any of which may
m> be either a single number (41), or a range (34 - 39). elements may or
m> may not appear in numerical order. Output should be either in order of
m> occurance, or in sorted numerical order. comas and - may or may not have
m> spaces around them.
that spec is ambiguous. what do you mean by 'either in order of
occurance, or in sorted numerical order'? pick one or the other.
also this has been done to death. expanding ranges is basically
trivial. your code is very bloated.
here is a quicky:
perl -lne 'push @f, $1 .. ($3 || $1) while /(\d+)(\s*-\s*(\d+))?/g; print "@f"'
i am sure it can be shortened.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: 29 Oct 2001 23:35:01 -0500
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: challenge, how short can you make this?
Message-Id: <m3u1whrbii.fsf@DCCMBX01.njitdm.campus.njit.edu>
mc <invalid@mctech.org> writes:
> input: $_ = "34 - 39 , 41 , 44";
>
> output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
perl -wle '$_="34 - 39 , 41 , 44"; s/-/../; @x=eval; print "@x"'
-mona
------------------------------
Date: Mon, 29 Oct 2001 21:48:26 -0600
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: challenge, how short can you make this?
Message-Id: <slrn9tsbie.fut.trammell@haqq.el-swifto.com>
On Mon, 29 Oct 2001 23:13:31 -0500, mc <invalid@mctech.org> wrote:
> Here's a challenge for those who like to boil scripts down to their
> lowest common denominator so to speak ....
>
> A script [segment] to do the following ...
>
> input: $_ = "34 - 39 , 41 , 44";
>
> output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
>
> input may contain any number of , separated elements, any of which may
> be either a single number (41), or a range (34 - 39). elements may or
> may not appear in numerical order. Output should be either in order of
> occurance, or in sorted numerical order. comas and - may or may not have
> spaces around them.
>
> below is my original code, which ive since boiled down to an extreme
> [censored] characters. (sorry, you'll have to wait <G>)
>
> -----8<----------8<----------8<----------8<-----
> $_ = "34 - 39 , 41 , 44"; # not included in character count
> @s = split(/\s*,\s*/,$_);
> foreach $e (@s) {
> if ( $e=~/-/ ) {
> ($s, $e) = split(/\s*-\s*/,$e);
> for ($i=$s;$i<=$e;$i++) { push @e, $i };
> } else {
> push @e, $e;
> };
> };
> foreach (@e) { print "[$_]\n" }; # print not part of specs
> -----8<----------8<----------8<----------8<-----
>
> formatting whitespace does not count toward length.
>
> how small can ya make it?
tr/ //; print join ",", map { /(\d+)-(\d+)/ ? ($1..$2) : $_ } split(/,/,$_);
Prolly some whitespace that can be ditched.
--
After Spamtember comes Proctober.
------------------------------
Date: Tue, 30 Oct 2001 04:50:14 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: challenge, how short can you make this?
Message-Id: <slrn9ts9lv.rgk.tadmc@tadmc26.august.net>
mc <invalid@mctech.org> wrote:
>Here's a challenge for those who like to boil scripts down to their
>lowest common denominator so to speak ....
We have a name for that: Perl Golf
http://www.sysarch.com/perl/golf/
But those are usually one-liners.
>A script [segment] to do the following ...
>
>input: $_ = "34 - 39 , 41 , 44";
>
>output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
[snip]
>how small can ya make it?
The "real work" is about a dozen characters.
--------------------------
#!/usr/bin/perl
use warnings;
use strict;
$_ = '34 - 39 , 41 , 44';
s/-/../g;
my @nums = eval;
print "$_\n" for @nums;
--------------------------
But you can't really use that in production code. String eval
is just too damn scary. So we could add a validating step
before the s/// above:
my $term = qr/(\d+\s*-\s*\d+)|\d+/;
s/$/,/; # cheater!
die "'$_' is not formatted correctly" unless /^($term\s*,\s*)+$/;
But that would be way too many characters, so we'll leave that
part out :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 30 Oct 2001 07:19:58 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: challenge, how short can you make this?
Message-Id: <slrn9tskn7.3nk.bernard.el-hagin@gdndev25.lido-tech>
On 29 Oct 2001 23:35:01 -0500, Mona Wuerz <wuerz@yahoo.com> wrote:
> mc <invalid@mctech.org> writes:
>
>> input: $_ = "34 - 39 , 41 , 44";
>>
>> output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
>
> perl -wle '$_="34 - 39 , 41 , 44"; s/-/../; @x=eval; print "@x"'
Exceptionally cool, Mona.
Cheers,
Bernard
------------------------------
Date: Tue, 30 Oct 2001 07:22:04 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: challenge, how short can you make this?
Message-Id: <slrn9tskr5.3nk.bernard.el-hagin@gdndev25.lido-tech>
On Tue, 30 Oct 2001 04:50:14 GMT, Tad McClellan <tadmc@augustmail.com> wrote:
> mc <invalid@mctech.org> wrote:
[snip]
> The "real work" is about a dozen characters.
>
> --------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> $_ = '34 - 39 , 41 , 44';
> s/-/../g;
> my @nums = eval;
>
> print "$_\n" for @nums;
> --------------------------
Same comment as to Mona's identical solution. Just saw hers first.
:-)
Cheers,
Bernard
------------------------------
Date: Tue, 30 Oct 2001 04:05:03 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Control M's still there? - how to make sure?
Message-Id: <slrn9ts65l.ras.tadmc@tadmc26.august.net>
Dan West <danno966@hotmail.com> wrote:
>you know vi, you can use /s/<ctl>v<ctl>m// at the command line to remove the
>offending bits.....
And if you know Perl, you can use
perl -p -i -e 'tr/\r//d' file1 file2 ...
to remove the Carriage Return characters (aka: control-Ms).
Giving a vi solution in a Perl newsgroup just doesn't seem "right" :-)
[snip upside-down quoted text]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 29 Oct 2001 20:24:15 -0800
From: train2venus@hotmail.com (venus)
Subject: filter data
Message-Id: <bce84cea.0110292024.66aa88a4@posting.google.com>
I'm stuck with the coding here...Hope you can help me with some ideas..
I got a text file which contains several data for the same locations as below:
A Famosa Golf Resort,MEL,MS 29-10-2001 32 24 14 14
A Famosa Golf Resort,MEL,MS 30-10-2001 33 22 14 14
A Famosa Golf Resort,MEL,MS 31-10-2001 33 24 13 13
Alor Gajah,MEL,MS 29-10-2001 32 24 14 14 13
Alor Gajah,MEL,MS 30-10-2001 33 22 14 14 13
Alor Gajah,MEL,MS 31-10-2001 33 24 13 13 13
And I want to write an output file based on the above text which looks like this:
A Famosa Golf Resort,MEL,MS,29-10-2001,14,14,30-10-2001,14,14,31-10-2001,13,13
Alor Gajah,MEL,MS,29-10-2001,14,13,30-10-2001,14,13,31-10-2001,13,13
while (<INPUT_FILE>) {
chomp;
( $city, $state, $country, @data ) = split(/,/);
$location = "$city,$state,$country";
if ( defined @data[0] && ! defined $StartDD ) {
$StartDD = @data[0];
}
if (defined $location) {
I dont have any idea how to do it. Appreciate your help.
Thanks..
------------------------------
Date: Tue, 30 Oct 2001 05:58:57 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: filter data
Message-Id: <BkrD7.255$X3.189625344@news.frii.net>
In article <bce84cea.0110292024.66aa88a4@posting.google.com>,
venus <train2venus@hotmail.com> wrote:
>I'm stuck with the coding here...Hope you can help me with some ideas..
>I got a text file which contains several data for the same locations as below:
>
>A Famosa Golf Resort,MEL,MS 29-10-2001 32 24 14 14
[...]
>Alor Gajah,MEL,MS 31-10-2001 33 24 13 13 13
>
>And I want to write an output file based on the above text which looks
>like this:
>
>A Famosa Golf Resort,MEL,MS,29-10-2001,14,14,30-10-2001,14,14,31-10-2001,13,13
>Alor Gajah,MEL,MS,29-10-2001,14,13,30-10-2001,14,13,31-10-2001,13,13
>
OK I'll take a stab. I'm a little confused about the selection
rules. And my technique is weak for big files but here it is anyway.
while (<DATA>) {
chomp;
@F = split(/\s\s+/);
push (@{$S{$F[0]}}, @F[1, $#F-1, $#F]);
}
for (sort keys %S) {
print join(',', $_, @{$S{$_}}), "\n";
}
__DATA__
A Famosa Golf Resort,MEL,MS 29-10-2001 32 24 14 14
A Famosa Golf Resort,MEL,MS 30-10-2001 33 22 14 14
A Famosa Golf Resort,MEL,MS 31-10-2001 33 24 13 13
Alor Gajah,MEL,MS 29-10-2001 32 24 14 14 13
Alor Gajah,MEL,MS 30-10-2001 33 22 14 14 13
Alor Gajah,MEL,MS 31-10-2001 33 24 13 13 13
Good Luck!
--
This space intentionally left blank
------------------------------
Date: 29 Oct 2001 20:23:35 -0800
From: perlbeginner@yahoo.com (PerlBeginner)
Subject: Overloading subroutine in package main::
Message-Id: <110bd594.0110292023.69151867@posting.google.com>
Considering the following code:
------------ start of "test.pl" ------------
require 'overload.pl' || die $!; # for production only
&example;
sub example{
print "This is for debug use\n";
}
------------ end of "test.pl" ------------
------------ start of "overload.pl" ------------
sub example{
print "This is for production use\n";
}
1;
------------ end of "overload.pl" ------------
For development use, I WILL NOT required 'overload.pl', therefore
the debugging version of &example will get executed.
For production use, I WILL require 'overload.pl', therefore the
production version of &example will get executed.
Here's my question:
1. I understand this is not a good practice in programming, what is the
proper way of implementing this?
2. How do I get rid of the perl warning since the subroutine &example is
re-defined in "test.pl" when I have already defined the subroutine
&example in 'overload.pl'.
3. I would like to be able to run the script under Apache::Registry.
Which means the script will be cache in the memory, and it will be
refreshed when 'test.pl' and 'overload.pl' has been changed.
Thanks for helping.
PerlBeginner
print "PerlBeginner B-)\n";
------------------------------
Date: Tue, 30 Oct 2001 05:25:54 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Overloading subroutine in package main::
Message-Id: <CRqD7.254$X3.202657280@news.frii.net>
In article <110bd594.0110292023.69151867@posting.google.com>,
PerlBeginner <perlbeginner@yahoo.com> wrote:
>Considering the following code:
>
>Here's my question:
>
>1. I understand this is not a good practice in programming, what is the
> proper way of implementing this?
As you say this is not good practice. As a rule don't put code into
production that has not been tested.
>
>2. How do I get rid of the perl warning since the subroutine &example is
> re-defined in "test.pl" when I have already defined the subroutine
> &example in 'overload.pl'.
>
You could mess about with the contents of @INC, exploit inheritance somehow
or just 'do' the library inside a conditional:
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# do_eg
# up.pl
# dn.pl
#
echo x - do_eg
sed 's/^X//' >do_eg << 'END-of-do_eg'
X#!/usr/bin/perl
X
Xif ($ARGV[0] eq "up") {
X do "up.pl";
X} else {
X do "dn.pl";
X}
X
Xeg();
END-of-do_eg
echo x - up.pl
sed 's/^X//' >up.pl << 'END-of-up.pl'
Xsub eg {
X print "up\n";
X}
END-of-up.pl
echo x - dn.pl
sed 's/^X//' >dn.pl << 'END-of-dn.pl'
Xsub eg {
X print "dn\n";
X}
END-of-dn.pl
exit
--
This space intentionally left blank
------------------------------
Date: Tue, 30 Oct 2001 06:11:59 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Perl from NT OS to Linux/Unix
Message-Id: <PwrD7.256$X3.190353408@news.frii.net>
In article <2856a052.0110291315.4a5c076c@posting.google.com>,
Straatvark <gert@up-front.co.za> wrote:
>I have a piece of perl code i want to run on a Unix box.
>
>I do remove the control-M's with a perl script on my windos OS
>I do upload in ASCII mode with CuteFTP 4.2.2
>I did try in with '#!/.../perl --' instead of '#!/.../perl'
>
[...]
>
>"Error Message: Permission denied
>Error Number: 13
>This message usually indicates there is a problem with the script
>itself. Often this indicates either that the #! line of the script is
>incorrect, or the script was uploaded in binary mode instead of ascii
>mode. Check to make sure that the script does not have control-M's at
>the end of every line. That will prevent it from executing. An easy
>fix that takes care of this most of the time is to put '#!/.../perl
>--' instead of '#!/.../perl' on the first line of the script. "
That error message is comming from somewhere outside perl. I hope
that you have something like #!/usr/bin/perl in there rather than
that literal "...". Take a look at "The Idiot's Guide to Solving Perl
CGI Problems" http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html.
Don't worry, the idiot that the author is talking about is not you.
Good Luck!
--
This space intentionally left blank
------------------------------
Date: 29 Oct 2001 22:39:23 -0800
From: tvn007@hotmail.com (Tim)
Subject: print out the difference between two arrays
Message-Id: <21724be2.0110292239.5f787fe9@posting.google.com>
Hi,
Here is my script:
#!/usr/local/bin/perl -w
# Purpose:
# This script determines if two arrays are the same.
# Create the arrays.
my @array1 = qw (0001 1234 2337);
my @array2 = qw (0001 1234 2337 7777);
# Check if the same elements are contained in the two arrays.
my $arrayString1 = join (' ', sort @array1);
my $arrayString2 = join (' ', sort @array2);
if ($arrayString1 eq $arrayString2)
{
print "Check 1: The arrays contain the same elements.\n";
}
else
{
print "Check 1: The arrays do not contain the same elements.\n";
}
##############################################
is it possible to have the script print out the difference between
@array1 and @array2 ? In this case, it should print
"@array2 has 7777"
Could someone please help me on this ?
Thanks in advance for your time
------------------------------
Date: Mon, 29 Oct 2001 23:12:10 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: print out the difference between two arrays
Message-Id: <3bde52d0@news.microsoft.com>
"Tim" <tvn007@hotmail.com> wrote in message
news:21724be2.0110292239.5f787fe9@posting.google.com...
> is it possible to have the script print out the difference between
> @array1 and @array2 ? In this case, it should print
> "@array2 has 7777"
>
> Could someone please help me on this ?
Your best help is the FAQ: "perldoc -q difference"
Found in C:\Perl\lib\pod\perlfaq4.pod
How do I compute the difference of two arrays? [...]
jue
------------------------------
Date: 29 Oct 2001 23:14:48 -0800
From: realnewbie2000@yahoo.com (Real Newbie)
Subject: Private instance variables in Objects ??
Message-Id: <a2b38b4d.0110292314.4bb86a5@posting.google.com>
Is there a way to create private variables in Perl Objects? If yes,
can someone give me a brief code example ...
Rgds,
R. Newbie
------------------------------
Date: Tue, 30 Oct 2001 12:20:28 +0800
From: hugo <hugo@fractalgraphics.com.au>
Subject: Re: selecting lines for single spacing
Message-Id: <3BDE2A8C.CD345DAE@fractalgraphics.com.au>
Thanks very much to everyone who helped me with the code for
"re-bundling" double-spaced lines back into single spaces for a given
keyword. Works like a dream now!
Thanks again - really helped me out.
Cheers
Hugo
hugo wrote:
>
> Hi
>
> I have a double-spaced input file and I would like to give the user the
> option to
> bundle several lines together single-spaced. For example, if you have
> the lines:
>
> some text here
>
> Subsequently here is some text
>
> which is now double spaced
>
> and should be single spaced.
>
> and some more text here
>
> I would like to give the reader the option to put in a keyword, which in
> this case would be "Subsequently" and a number of lines, say 3. This
> would bundle
> 3 lines single spaced so that we end up with:
>
> some text here
>
> Subsequently here is some text
> which is now double spaced
> and should be single spaced.
>
> and some more text here
>
> I would like the user to be able to repeat this process for several
> keywords and number of lines.
> At the end I would like to have an output file, with all specified lines
> now single-spaced and the remainder double-spaced.
>
> I have tried to get this to work, but I am afraid I am getting rather
> seriously stuck.
>
> Can anyone help me with this?
>
> Any help, particularly a code example, will be greatly appreciated.
>
> Thanks.
>
> Hugo
>
> --
> Dr Hugo Bouckaert
> R&D Support Engineer, Fractal Graphics
> 57 Havelock Street, West Perth 6005
> Western Australia 6009
> Tel: +618 9211 6000 Fax: +618 9226 1299
> Email:hugo@fractalgraphics.com.au
> Web: http://www.fractalgraphics.com.au
--
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics
57 Havelock Street, West Perth 6005
Western Australia 6009
Tel: +618 9211 6000 Fax: +618 9226 1299
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au
------------------------------
Date: Tue, 30 Oct 2001 03:46:50 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: What's wrong with File::Find
Message-Id: <KopD7.138019$NT3.14815189@news1.rdc1.ct.home.com>
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> Dan Sugalski
> <dan@tuatha.sidhe.org>], who wrote in article <a1YC7.133631$NT3.14336070@news1.rdc1.ct.home.com>:
>> > Hmm? Unless on some advanced OS (e.g., OS/2 allows thread-local
>> > storage, with which different thread read different data from the same
>> > virtual address), you can *always* pass a pointer to something
>> > thread-specific to another thread. So what you say has no meaning,
>> > thus irrelevant.
>>
>> Nonsense. Thread-specific has a definite meaning for most people--"only
>> available to a particular thread".
> Unless on some advanced OS (e.g., OS/2 allows thread-local storage,
> with which different thread read different data from the same virtual
> address),
That's not particularly advanced, Ilya, nor is it at all OS/2 specific.
Unless you have a very small amount of data you're hiding from other
threads it's also fairly expensive on SMP machines, since it means messing
with your MMU structures on thread switch, which tends to cause a variety
of TLB invalidations.
> you can *always* pass a pointer to something thread-specific
> to another thread. Given that there is no "object" which satisfies
> your definition, I doubt that "most people" agree with your definition.
I have no doubt that you doubt it, Ilya. That doesn't make you any less
wrong.
There is no object, generally speaking, which is private to a particular
thread. I fully agree with that, because it's true. People *still* there
is, and they *still* think that lexicals are somehow magically bound to a
particular thread and invisible to other threads, and they are *still*
profoundly surprised when they find the variable whose reference they
stuck in a global variable gets changed by another thread, or wonder why
the heck the lexicals they're working with are visible to other threads.
I wrote the damn docs on it and I still get mail about it from the folks
not scared off by the "5.005-style threads suck big time and IThreads will
magically save the world" notes at the top of the docs. (This would be a
really good time for you to not make any smart remarks about document
quality either--the docs are really clear about the visibility of
variables)
And, to be really blunt, you just make the situation worse when you
blithely prattle on about lexicals being thread-specific when you know
damn well they aren't.
People hear the phrase "thread specific" and think we're doing some vague
magic. We aren't, and you shouldn't use the phrase except in the negative
sense, since it does nothing but strengthen people's misapprehensions.
dan
------------------------------
Date: Tue, 30 Oct 2001 06:25:41 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: What's wrong with File::Find
Message-Id: <9rlh55$1ogl$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Dan Sugalski
<dan@tuatha.sidhe.org>], who wrote in article <KopD7.138019$NT3.14815189@news1.rdc1.ct.home.com>:
> > Unless on some advanced OS (e.g., OS/2 allows thread-local storage,
> > with which different thread read different data from the same virtual
> > address),
> That's not particularly advanced, Ilya, nor is it at all OS/2 specific.
I never said either of the things you imply I said.
> Unless you have a very small amount of data you're hiding from other
> threads it's also fairly expensive on SMP machines, since it means messing
> with your MMU structures on thread switch, which tends to cause a variety
> of TLB invalidations.
Hmm? If it is SMP, what relevance is the thread switch? Anyway, on
OS/2 the info is stored in the thread control segment, so it does not
add any significant overhead to the thread switch.
> I wrote the damn docs on it and I still get mail about it from the folks
> not scared off by the "5.005-style threads suck big time and IThreads will
> magically save the world" notes at the top of the docs. (This would be a
> really good time for you to not make any smart remarks about document
> quality either--the docs are really clear about the visibility of
> variables)
Clarity of the docs does not ensure its quality. Clarity *and*
sufficiently small volume usually do. With the shear (unneeded)
volume of Perl docs I do not wonder that you "still get mail about
it". It is simply impossible to get fluent with the docs...
> And, to be really blunt, you just make the situation worse when you
> blithely prattle on about lexicals being thread-specific when you know
> damn well they aren't.
I know damn well they are.
> People hear the phrase "thread specific" and think we're doing some vague
> magic.
I sympathize with your feelings, but you cannot fight absense of
education with more smoke and mirror. Especially not with redefining
"thread specific" to mean different things than most people know this
term means. Especially when the meaning you insists on is content-free.
Ilya
------------------------------
Date: Tue, 30 Oct 2001 08:19:59 +0100
From: Mika Morell <mika.morell@no-spam-what-so-ever.se.abb.com>
Subject: Win32 port of PerlTK
Message-Id: <3BDE549F.BFFA7ACC@no-spam-what-so-ever.se.abb.com>
Hi.
Is there anyone who knwos where to get a binary package of Perl/TK for
Win32. I am having trouble to compile the sourcecode since i am using
djgpp and gcc.
//Mika
------------------------------
Date: Tue, 30 Oct 2001 07:28:40 GMT
From: Mika Morell <mika.morell@no-spam-what-so-ever.se.abb.com>
Subject: Win32 port of PerlTK
Message-Id: <IEsD7.131902$ob.2986331@news1.rdc1.bc.home.com>
Hi.
Is there anyone who knwos where to get a binary package of Perl/TK for
Win32. I am having trouble to compile the sourcecode since i am using
djgpp and gcc.
//Mika
}
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 2034
***************************************