[18906] in Perl-Users-Digest
Perl-Users Digest, Issue: 1074 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 6 14:06:18 2001
Date: Wed, 6 Jun 2001 11:05:27 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <991850727-v10-i1074@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 6 Jun 2001 Volume: 10 Number: 1074
Today's topics:
Re: (csv) Split at a coma, how? <todd@designsouth.net>
Re: (csv) Split at a coma, how? <gnarinn@hotmail.com>
Re: (csv) Split at a coma, how? <stevemartintelecom@home.com>
Re: (csv) Split at a coma, how? <stevemartintelecom@home.com>
Re: (csv) Split at a coma, how? <todd@designsouth.net>
Re: (csv) Split at a coma, how? <bill.kemp@wire2.com>
Re: (csv) Split at a coma, how? <stevemartintelecom@home.com>
Re: (csv) Split at a coma, how? <todd@designsouth.net>
Re: (csv) Split at a coma, how? (John Joseph Trammell)
Re: 2 questions about flock <m.grimshaw@salford.ac.uk>
Re: 2 questions about flock nobull@mail.com
BLAT problems just popped up; doesn't like To: address <scott-donspahmme@gdinet.com>
Re: BLAT problems just popped up; doesn't like To: addr <joe+usenet@sunstarsys.com>
Re: Bug in assignment operator nobull@mail.com
Re: Date of Halloween (for Date::Calc module)? <todd@designsouth.net>
Re: Date of Halloween (for Date::Calc module)? (Anno Siegel)
Re: Date of Halloween (for Date::Calc module)? <todd@designsouth.net>
Re: delimiter? <todd@designsouth.net>
Re: Easier access to system call output - maybe output (Tad McClellan)
edit text database SCRIPT <helpmeplese@helpmeplese.com>
Re: Executing perl Scripts? (Tad McClellan)
Expat <timster@worldnet.att.net>
Re: FAQ 6.19: What good is "\G" in a regular expressi <ren@tivoli.com>
Re: Flame,help or killfile ? (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 06 Jun 2001 15:16:52 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <EPrT6.118214$I5.27391631@news1.rdc1.tn.home.com>
"Steve Martin" <stevemartintelecom@home.com> wrote in message
news:cxrT6.44423$Be4.14411182@news3.rdc1.on.home.com...
> Hi,
>
> I am doing a small script that opens a weekly schedule that an admin
assist
> is producing and saving in .csv.
> I need to know how to split at every coma in order to incert every
> separation in a nice html table.
Wow Steve Martin!
just use this, sir:
while (<FILE>) {
chomp;
@a = split /,/;
for (@a) {
print "<td>$_</td>";
}
}
or to be quick:
print map "<td>$_</td>", map{ split /,/ } (<FILE>);
p.s.: I loved "The Jerk"
-todd
------------------------------
Date: Wed, 6 Jun 2001 14:51:28 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <991839088.0114694745279849.gnarinn@hotmail.com>
In article <cxrT6.44423$Be4.14411182@news3.rdc1.on.home.com>,
Steve Martin <stevemartintelecom@home.com> wrote:
>print '<tr><td>';
$line =~ s/,/<\/td><td>/g;
>print $line;
>print '</td></tr>';
is this what you want?
gnari
------------------------------
Date: Wed, 06 Jun 2001 15:52:10 GMT
From: "Steve Martin" <stevemartintelecom@home.com>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <KksT6.44599$Be4.14473841@news3.rdc1.on.home.com>
Hi Todd,
Thanks!!!!
The only thing, I need to also split every line. Before, I was only able to
split every lines, now I can only split the cells.
How can I do both?
Steve
"Todd Smith" <todd@designsouth.net> wrote in message
news:EPrT6.118214$I5.27391631@news1.rdc1.tn.home.com...
>
> "Steve Martin" <stevemartintelecom@home.com> wrote in message
> news:cxrT6.44423$Be4.14411182@news3.rdc1.on.home.com...
> > Hi,
> >
> > I am doing a small script that opens a weekly schedule that an admin
> assist
> > is producing and saving in .csv.
> > I need to know how to split at every coma in order to incert every
> > separation in a nice html table.
>
> Wow Steve Martin!
>
> just use this, sir:
>
> while (<FILE>) {
> chomp;
> @a = split /,/;
> for (@a) {
> print "<td>$_</td>";
> }
> }
>
> or to be quick:
>
> print map "<td>$_</td>", map{ split /,/ } (<FILE>);
>
> p.s.: I loved "The Jerk"
>
> -todd
>
>
------------------------------
Date: Wed, 06 Jun 2001 15:52:57 GMT
From: "Steve Martin" <stevemartintelecom@home.com>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <tlsT6.44600$Be4.14474562@news3.rdc1.on.home.com>
Hi Todd,
Thanks!!!!
The only thing, I need to also split every line. Before, I was only able to
split every lines, now I can only split the cells.
How can I do both?
Steve
"Steve Martin" <stevemartintelecom@home.com> wrote in message
news:cxrT6.44423$Be4.14411182@news3.rdc1.on.home.com...
> Hi,
>
> I am doing a small script that opens a weekly schedule that an admin
assist
> is producing and saving in .csv.
> I need to know how to split at every coma in order to incert every
> separation in a nice html table. I need the splitting codes that could be
> added to my own codes. See the perl codes a the bottom of this post.
>
>
> The schedule looks something like this: <start>
>
> "Version finale, le 18 mai,
> 2001",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> Saison du 4 juin au 3 septembre
> 2001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> Rogers télé-communautaire 23 (horaire
> d'été),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> Heure,Lundi ,Mardi ,Mercredi ,Jeudi,Vendredi ,,Samedi ,Dimanche
> ,Heure,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 9:00,Babillard communautaire de 00:00 à
> 17:00,,,,,,,,9:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 9:30,,,,,,,,,9:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 10:00,,,,,,,,,10:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 10:30,,,,,,,,,10:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 11:00,,,,,,,,,11:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 11:30,,,,,,,,,11:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 12:00,,,,,,,,,12:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 12:30,,,,,,,,,12:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 13:00,,,,,,,,,13:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 13:30,,,,,,,,,13:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 14:00,,,,,,,,,14:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 14:30,,,,,,,,,14:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> 15:00,,,,,,,,,15:00
> 15:30,,,,,,,,,15:30
> 16:00,,,,,,,,,16:00
> 16:30,,,,,,,,,16:30
> 17:00,L'Art Floral,Coup de Pinceau,De fil en
> Aiguille,Grouille-toi,Programmation Spéciale,,Programmation
> Spéciale,Programmation Spéciale,17:00
> 17:30,Bouquet de Saveurs,,,,,,Bouquet de saveurs (2),Bouquet de
> saveurs (2),17:30
> 18:00,Deux Par Quatre,,,,,,Deux Par Quatre (2),Deux Par Quatre
> (2),18:00
> 18:30,Cardio Hip Hop,,,,,,Cardio Hip-Hop (2),Cardio Hip-Hop
(2),18:30
> 19:00,L'Art Floral,Coup de Pinceau,De fil en
> Aiguille,Grouille-toi,Programmation
> Spéciale,,Grouille-toi,Grouille-toi,19:00
> 19:30,Bouquet de Saveurs,,,,,,Répertoire (Sinon reprise du Bloc de
> 17:00),Bouquet de saveurs (2),19:30
> 20:00,Deux Par Quatre,,,,,,,Deux Par Quatre (2),20:00
> 20:30,Cardio Hip Hop,,,,,,,Cardio Hip-Hop (2),20:30
> 21:00,Répertoire (Sinon reprise du Bloc de 17:00),Coup de
> Pinceau,Répertoire (Sinon reprise du Bloc de
17:00),Grouille-toi,Répertoire
> (Sinon reprise du Bloc de 17:00),,,Coup de inceau,21:00
> 21:30,,Bouquet de Saveurs,,Bouquet de Saveurs,,,Babillard
> communautaire de 21:30 à 0:00,,21:30
> 22:00,,Deux Par Quatre,,Deux Par Quatre,,,,,22:00
> 22:30,Cardio Hip Hop,Cardio Hip Hop,Cardio Hip Hop,Cardio Hip
> Hop,Cardio Hip-Hop,,,,22:30
> 23:00,Babillard communautaire de 23:00 à
>
:00,,,,,,,,23:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
>
23:30,,,,,,,,,23:30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
> ,,,,,,,,,,,,,,,,,,,,,,,,,,,
>
>
> </end>
>
>
> #!usr/bin/perl
>
> print "Content-type: text/html\n\n";
>
> $doc= 'D:\Apache\cgi-bin\horaire.csv';
> open(CN, $doc)|| die $!;
> my %lines;
> my @doc = <CN>;
> my $line = <CN>;
> print "<table>\n";
> foreach my $line (@doc){ #### Also split at every coma in a line and
> incert the splitted data even if it is just a blank space inside an HTML
> cell (<tr> <td> data </td> <td> next cell </td> </tr>)
> print '<tr><td>';
> print $line;
> print '</td></tr>';
> }
> print "</table>";
> close CN;
>
>
> Thanks!!!
>
> Steve Martin
>
>
>
------------------------------
Date: Wed, 06 Jun 2001 15:57:40 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <UpsT6.118296$I5.27412990@news1.rdc1.tn.home.com>
"Steve Martin" <stevemartintelecom@home.com> wrote in message
news:tlsT6.44600$Be4.14474562@news3.rdc1.on.home.com...
> Hi Todd,
>
> Thanks!!!!
>
> The only thing, I need to also split every line. Before, I was only able
to
> split every lines, now I can only split the cells.
>
> How can I do both?
>
> Steve
>
you mean you want <tr>'s too?
print "<table>";
while (<FILE>) {
chomp;
@a = split /,/;
print "<tr>";
for (@a) {
print "<td>$_</td>";
}
print "</tr>\n";
}
print "</table>";
------------------------------
Date: Wed, 6 Jun 2001 17:06:45 +0100
From: "pete" <bill.kemp@wire2.com>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <991843680.28314.0.nnrp-01.c3ad6974@news.demon.co.uk>
I do prefer the regexp. to search and replace for commas.
(personal preference perhaps)
>or to be quick:
>
>print map "<td>$_</td>", map{ split /,/ } (<FILE>);
>
what about
$,="</td><td>";
print(split /,/);
No. Yuk, need 2 other print statements
------------------------------
Date: Wed, 06 Jun 2001 17:33:42 GMT
From: "Steve Martin" <stevemartintelecom@home.com>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <WPtT6.44677$Be4.14576253@news3.rdc1.on.home.com>
Hi Todd,
Last thing, when there is a cell with no data inside, it does not write any
any HTML cell. It does when there is data after a coma, but not if there is
none. How can I get it to create these codes <td> </td> when there is
no data after a coma.
Thanks!
Steve
"Todd Smith" <todd@designsouth.net> wrote in message
news:UpsT6.118296$I5.27412990@news1.rdc1.tn.home.com...
>
> "Steve Martin" <stevemartintelecom@home.com> wrote in message
> news:tlsT6.44600$Be4.14474562@news3.rdc1.on.home.com...
> > Hi Todd,
> >
> > Thanks!!!!
> >
> > The only thing, I need to also split every line. Before, I was only
able
> to
> > split every lines, now I can only split the cells.
> >
> > How can I do both?
> >
> > Steve
> >
>
> you mean you want <tr>'s too?
>
> print "<table>";
> while (<FILE>) {
> chomp;
> @a = split /,/;
> print "<tr>";
> for (@a) {
> print "<td>$_</td>";
> }
> print "</tr>\n";
> }
> print "</table>";
>
>
------------------------------
Date: Wed, 06 Jun 2001 17:47:56 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <g1uT6.119000$I5.27468043@news1.rdc1.tn.home.com>
> >
> > print "<table>";
> > while (<FILE>) {
> > chomp;
> > @a = split /,/;
> > print "<tr>";
> > for (@a) {
$cell = $_ || ' ';
> > print "<td>$cell</td>";
> > }
> > print "</tr>\n";
> > }
> > print "</table>";
> >
> >
------------------------------
Date: Wed, 06 Jun 2001 17:52:11 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: (csv) Split at a coma, how?
Message-Id: <slrn9hsot9.21o.trammell@bayazid.hypersloth.net>
On Wed, 06 Jun 2001 14:57:12 GMT, Steve Martin wrote:
> I am doing a small script that opens a weekly schedule that an
> admin assist is producing and saving in .csv.
I'll help you, but first I want you to do that one trick
where you suck a piano into your lungs.
--
The cost of software has always been development cost, not replication
cost. Sharing that cost among even a few users radically cuts the
per-user cost.
-- F. Brooks fails to predict IP disputes in _No Silver Bullet_
------------------------------
Date: Wed, 06 Jun 2001 16:34:20 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: 2 questions about flock
Message-Id: <3B1E4D7C.9C9E08D3@salford.ac.uk>
Mark Grimshaw wrote:
>
> Anno Siegel wrote:
> <snip>
> > > 3/ A successful lock operation returns 0.
> >
> > A successful flock(2) (the system call) returns 0 on success. Perl
> > inverts the logic and returns a true value on success and a false
> > on error.
> >
> > This convention is true for most or all system- and library calls
> > that Perl supports: The original returns an error number, or 0
> > if there is no error. Perl returns a false value if there is an
> > error (and puts the error message in $!), or returns true for success.
>
> >
> > Anno
>
> Oh OK will try this later. I got my 3/ understanding from man flock:
>
> RETURN VALUE
> Zero is returned if the operation was successful; on an error a -1
> is
> returned and an error code is left in the global location errno.
Got it all working - thanks for all your help and suggestions!
The major problem was file permissions.
Lesson 1 - always check the status of open() and in particular $!.
Lesson 2 - always check the status of open() and in particular $!.
Lesson 3 - always check the status of open() and in particular $!.
....
The lockfile was placed in a directory owned/writable etc. by nobody.
The first instance of open() for write mode on this file was in my
locking script which was run as root which of course created the lock
file in that directory but created it as owned by root. In my CGI
script, I wasn't checking to see if the file was actually opened. It
wasn't as it could not open() a file owned by root - hence the flock()
would not work. I thought I was checking to see if flock() was working
by testing for -1 (see above).....
------------------------------
Date: 06 Jun 2001 18:33:02 +0100
From: nobull@mail.com
Subject: Re: 2 questions about flock
Message-Id: <u94rttzf75.fsf@wcl-l.bham.ac.uk>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> According to Alan J. Flavell <flavell@mail.cern.ch>:
> > But suppose that the action of reading it and doing whatever
> > processing was needed, was something that took a significant amount of
> > time, during which you wanted other processes (using suitable locking,
> > of course) to be able to read it. It seems as if there's no really
> > feasible way to leave the file shareable until the update is ready,
> > and then somehow upgrade the lock for writing the new contents to the
> > file.
Correct. Some locking models (but not the ones accessible on most
operating systems via Perl's flock()) have three lock types
read/write/protect. A "protect" lock is exclusive in so far as only
one process can hold a "protect" lock but is shared in so far as other
processes can simulateously hold read locks. You can safely promote a
protect lock to a write lock.
> My naive assumption has been that you simply lock a file again when
> you want to change the type of lock. This has worked as expected in
> a few experiments.
But will eventually get into a deadly embrace.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 6 Jun 2001 11:49:57 -0500
From: "Scott Trautman" <scott-donspahmme@gdinet.com>
Subject: BLAT problems just popped up; doesn't like To: address
Message-Id: <3b1e5f35$1@goodnews1.globaldialog.com>
Very sorry for posting here, as close to appropriate as I could find from
searching on dejanews.
As of April 25th, blat, which has worked quite nicely for <years>, all of a
sudden quit working; it's giving the error that "Mail server doesn't like
the To: address xxxx@yyyy.com".
I'm guessing I changed <something> to bring this about, but can't for the
life of me think of what.
Blat is a mini-command line SMTP mailer that I use with Perl and whatever
else to send output via email.
Basically any troubleshooting techniques or ideas would be really helpful.
I've tried:
- shutting down my IIS SMTP service (thrashing for sure)
- can't think of anything else that not allow me to get to port 25;
- looked through the cpp source code, but since I don't have an NT compiler,
and am not inclined to buy one just for this, can't get extra diagnostic
output there, either.
Looks to me, from reviewing the source, it's expecting 250 chars or so of
output, if it doesn't, it pukes.
Any ideas or any other utility like this as useful?
Thanks in advance.
SMT
------------------------------
Date: 06 Jun 2001 13:51:56 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: BLAT problems just popped up; doesn't like To: address
Message-Id: <m3hextijib.fsf@mumonkan.sunstarsys.com>
"Scott Trautman" <scott-donspahmme@gdinet.com> writes:
> Very sorry for posting here, as close to appropriate as I could find from
> searching on dejanews.
^^^^^^^^
Dejanews is dead- try google instead. A cursory web search for
"blat IIS" turned up lots of potentially relevant information- here's
one that might be helpful:
http://groups.yahoo.com/group/blat/message/468
IMHO you'd be better off taking your question to a blat-related
mailing list anyway, since the problem is probably not Perl-related.
Good luck.
--
Joe Schaefer "The surest protection against temptation is cowardice."
--Mark Twain
------------------------------
Date: 06 Jun 2001 18:41:32 +0100
From: nobull@mail.com
Subject: Re: Bug in assignment operator
Message-Id: <u91yoxzesz.fsf@wcl-l.bham.ac.uk>
"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> Anno Siegel wrote:
> > my $num_parts = () = split /,/, 'a,b,c', -1;
>
>
> Your logic is still impaired. You are not providing a valid
> solution. You are simply causing the split to be fully
> evaluated before providing a return value.
That's exactly what he wanted to do.
> Use of a negative one is not a valid solution; it is bad syntax
> producing correct results by coincidence.
Could you please explain that.
By "bad syntax" do you mean "aesthetically displeasing to Godzilla" or
do you mean "the fact that the it compiles at all is a compiler bug".
> It is prudent to test both code and concepts before
> announcing a "rule" regarding exhibited behavior
> of Perl code.
[ Snip good empirical evidence that there's nothing wrong with Anno's
logic ]
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 06 Jun 2001 15:40:10 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <u9sT6.118252$I5.27403686@news1.rdc1.tn.home.com>
"Steffen Beyer" <sb@engelschall.com> wrote in message
news:p9alf9.72b.ln@imperia.net...
>
> In order to complete my holidays profiles, I'd need to know when
> exactly is Halloween in the United States (and possibly elsewhere
> as well) commemorated?
It's always October 31
------------------------------
Date: 6 Jun 2001 16:10:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <9flklt$ooh$2@mamenchi.zrz.TU-Berlin.DE>
According to Todd Smith <todd@designsouth.net>:
>
> It's always October 31
YM September. HTH.
Anno
------------------------------
Date: Wed, 06 Jun 2001 17:48:52 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <82uT6.119012$I5.27468398@news1.rdc1.tn.home.com>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:9flklt$ooh$2@mamenchi.zrz.TU-Berlin.DE...
> According to Todd Smith <todd@designsouth.net>:
> >
> > It's always October 31
>
> YM September. HTH.
>
> Anno
what?
------------------------------
Date: Wed, 06 Jun 2001 16:00:26 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: delimiter?
Message-Id: <ussT6.118308$I5.27414463@news1.rdc1.tn.home.com>
"Tim" <timster@worldnet.att.net> wrote in message
news:3B1DA595.9C2F00C6@worldnet.att.net...
> perl -e "@INC" shows:
> D:/Perl/libD:/Perl/site/lib.
>
> I don't see a delimiter between "D:/Perl/lib" and "D:/Perl/site/lib".
> How does it know that this is really two directories instead of one?
>
>
when you print arrays, it just shows the items side by side unless you set
$, to something.
[root@raq300 web]# perl
@a = 1..10;
print @a;
print "\n";
@b = 1..10;
$, = ', ';
print @b;
print "\n";
12345678910
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
[root@raq300 web]#
------------------------------
Date: Wed, 6 Jun 2001 09:19:43 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Easier access to system call output - maybe output to a scaler?
Message-Id: <slrn9hsbfe.4sh.tadmc@tadmc26.august.net>
William Cardwell <EUSWMCL@am1.ericsson.se> wrote:
>I wrote:
>>
>> In VMS (sorry), I would like to do system commands and operate on the output
>> from the call in the simplest way, say output to a scaler instead of a file.
>
>
>This works great in VMS:
>
>$x=`DIR *.txt`;
>print $x;
The entire output of the command must fit in memory for backticks.
You're not likely to have "large" output for DIR, but it should
be considered in the general case.
>... so does this:
>
>open PROG, 'dir *.txt|' or "die can't open program: $!";
^^^^^
^^^^^ s/"die /die "/
Please do not attempt to retype code. Use copy/paste, or import
or something to avoid introducing typos that are not in your
real code.
There you have only a single line's worth in memory at any time. This
is a good way if the called program's output is large, or if the
program runs for a "long time".
>while (<PROG>) {
> print "$. $_"; # Prove it works
>}
>
>Thanks so much for your help, Tad and Damian.
One more thing :-)
The diag message for your pipe open is misleading, and probably
won't execute when you think it will. The die() is NOT evaluated in:
open(PROG, 'nosuchcommand *.txt|') or die "can't open program: $!";
See the Perl FAQ, part 8:
"Why doesn't open() return an error when a pipe open fails?"
You should check the return value from close() for pipe-opened
file handles:
open PROG, 'dir *.txt|' or die "can't fork for 'dir': $!";
while (<PROG>) { ... }
close PROG or die "problem running 'dir': $!";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 6 Jun 2001 13:38:49 -0400
From: "helpmeplease" <helpmeplese@helpmeplese.com>
Subject: edit text database SCRIPT
Message-Id: <9flqe9$igh$1@sshuraab-i-1.production.compuserve.com>
Hello,
I'm can anyone point me in the right direction please.
i'm trying to edit a flat text database. This is my edit page.
Why are values not pass on to SAVE cgi routine ?
After i press SAVE it goes to where it is suppose to, but,
all new FIELD values are not passed on.
Why won't this work.
if ($formdata{'Selection'} eq "EDIT") {
print "Content-type: text/html\n\n";
print <<"HTML";
<html><head></head><body>
HTML
$index = "$formdata{'DatBNum'}"; #selection chosen to edit(this works)
# seek LOG, 0, 0; # would like to use but can't get it to work
open (LOG,"<FILE.dat") || &Error("$state ERROR");
@logdata = <LOG>;
close (LOG);
flock(LOG, 8);
@logdata=split(/\|/,"@logdata");
print <<"HTML2";
<TABLE width=500>
<TR><TD>
<form method=post action="http://www.somewere.com/cgi-bin/edit.cgi">
<input type=text name="FIELD22" value="$logdata[$index-21]" size=35
maxlength=20>
</TD></TR></TABLE>
HTML2
print <<"HTML3";
<a href="$ScriptURL?Selection=SAVE&Department=$DEPT">SAVE</a>
# <INPUT TYPE="submit" VALUE="SAVE"> i've tried this but dont work either
</form>
</body>
</html>
HTML3
}
if ($formdata{'Selection'} eq "SAVE") {
print "Content-type: text/html\n\n";
print <<"HTML";
<html><head></head><body>
HTML
$formdata{'FIELD22'}
</body></html>
}
Can't get values to pass to this SAVE section
Any suggestion will be helpful
Thanks,
helpmeplease
------------------------------
Date: Wed, 6 Jun 2001 09:22:50 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Executing perl Scripts?
Message-Id: <slrn9hsbla.4sh.tadmc@tadmc26.august.net>
Harsh Strider <harsh_strider@yahoo.com> wrote:
>(Run from a terminal window inside GNOME)
>
>root@localhost Perl# ./test.pl
>bash: /home/root/perl/test.pl: Permission Denied
>root@localhost Perl#
>
>I am logged on as root.
>Any thoughts?
I think I'd like to know what the permissions for test.pl are,
since the message seems to say that that is the problem :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 06 Jun 2001 15:22:16 GMT
From: Tim <timster@worldnet.att.net>
Subject: Expat
Message-Id: <3B1E4A88.68FAC6@worldnet.att.net>
I tried 'make'-ing the Expat module which is NOT on CPAN, but on
www.sourceforge.com. This module is a prequisite for XML::Parser. I
ran ./configure and then 'perl Makefile.PL', but I got:
perl Makefile.PL EXPATLIBPATH=/home/tim/perl/expat-1.95.1/lib
EXPATINCPATH=/home/tim/perl/expat-1.95.1/lib
Note (probably harmless): No library found for -lexpat
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
The reason for the warning is that the in the lib file, it created:
libexpat.la instead of libexpat.a. What is .la??? What kind of library
is that? The only libraries I know all are of the form libXXXX.a.
If I rename libexpat.la to libexpat.a, then when I then run "make", I
get:
ld: fatal: file /home/tim/perl/expat-1.95.1/lib/libexpat.a: unknown file
type
ld: fatal: File processing errors. No output written to
../blib/arch/auto/XML/Parser/Expat/Expat.so
make[1]: *** [../blib/arch/auto/XML/Parser/Expat/Expat.so] Error 1
Any help would be appreciated.
------------------------------
Date: 06 Jun 2001 10:21:06 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: FAQ 6.19: What good is "\G" in a regular expression?
Message-Id: <m3g0ddtz19.fsf@dhcp9-173.support.tivoli.com>
On Wed, 6 Jun 2001, johnlin@chttl.com.tw wrote:
> Nope? Or this (multiline case) is not achievable by \G + /g ?
Well, it isn't pretty, but you could use:
s/(?:\G|^)>/:/gm;
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 6 Jun 2001 17:36:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Flame,help or killfile ?
Message-Id: <9flpnq$s81$2@mamenchi.zrz.TU-Berlin.DE>
According to buggs <buggs@geekmail.de>:
> Considering the recent discussions on this topic
> you migth be interested in the following.
>
> See Simons article:
As has been mentioned, the author is Casey West.
> http://www.perl.com/pub/2001/05/29/tides.html
The article reads like a pamphlet to be passed around among the
recruiting staff of a sect fishing for members. In particular, it
rests on the not-quite-tacit assumption that the "very thing we
want to have happen" is "adding number to our ranks [of Perl
programmers]".
Well, I wonder. The most wide-spread language[1] of the past is
neither very influential (except setting some examples how not
to do it), nor does it have a favorable reputation. Contrast this
to Lisp, which has never been a mainstream language, but has enormous
influence and a more than respectable reputation. "Adding number"
isn't necessarily good for a language.
It seems to me that Perl as a culture is at a point where its rapid
growth is more of a challenge than a boon. A large part of the problems
we are experiencing in clpm is due to the sheer number of people who
take at least a passing interest in Perl. There simply aren't enough
regulars to answer all of the questions, and monitor suspect answers,
and still have time to discuss one or another Perl issue of interest.
So the tolerance level is low, what else could it be? While unpleasant
(sometimes in an entertaining way), this is a necessary and basically
healthy reaction. Time will show whether it will work to keep the
group useful and interesting.
Anno
[1] FORTRAN, in case you hadn't guessed.
------------------------------
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 1074
***************************************