[9611] in Perl-Users-Digest
Perl-Users Digest, Issue: 3205 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 20 14:14:27 1998
Date: Mon, 20 Jul 98 11:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 20 Jul 1998 Volume: 8 Number: 3205
Today's topics:
Re: /^[a-z0-9]/ (Abigail)
Re: A simple question about sub routines <jdporter@min.net>
Re: A simple question about sub routines <jdporter@min.net>
Array element translation <jjune@midway.uchicago.edu>
Re: Array element translation <merlyn@stonehenge.com>
Re: Array element translation <khaines@oshconsulting.com>
Re: Array element translation (Larry Rosler)
CGI: how to force Netscape to show results line by line (Alex Dong Li)
Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. p (Snowhare)
comp.lang.perl.moderate (Zheng Yuan)
Re: Lex for Perl / Object Dumper? <swoboda@uvic.ca>
mod_perl on RedHat 5.1 <josepj00@molbio.sbphrd.com>
need help: open file for write lindali@my-dejanews.com
Re: need help: open file for write <ajohnson@gpu.srv.ualberta.ca>
Re: need help: open file for write (Larry Rosler)
Re: novice Q; reading columns of numbers <jdporter@min.net>
Re: novice Q; reading columns of numbers <jdporter@min.net>
Re: OOP : Object Oriented PROBLEMS! <jdporter@min.net>
Re: Perl Beautifier Home Page (Abigail)
perl file manipulation --help (Zheng Yuan)
Re: Perl for kids (Greg Bacon)
Re: perl4/perl5 differences (Michael Stevens)
Re: Print LoL-tree routine (attached) <swoboda@uvic.ca>
Re: Program to give day of the week from given date <zenin@bawdycaste.org>
PS1 update from a background script <dunna001@bama.ua.edu>
Re: Regex: operand could be empty <ajohnson@gpu.srv.ualberta.ca>
Re: Regex: operand could be empty (Larry Rosler)
Re: sort function (CGI-Perl) (Abigail)
Re: subscript on numeric <matt@whiterabbit.co.uk>
Re: using get quicker <jdporter@min.net>
Wierd behaviour of .. operator <Richard@waveney.demon.co.uk>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Jul 1998 16:29:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: /^[a-z0-9]/
Message-Id: <6ovr8l$dld$1@client3.news.psi.net>
Jonathan Feinberg (jdf@pobox.com) wrote on MDCCLXXXIV September MCMXCIII
in <URL: news:hg0cwovv.fsf@mailhost.panix.com>:
++ abigail@fnx.com (Abigail) writes:
++
++ > Jonathan Feinberg (jdf@pobox.com) wrote on MDCCLXXXIII September MCMXCIII
++ > in <URL: news:7m19er3d.fsf@mailhost.panix.com>:
++ > ++ abigail@fnx.com (Abigail) writes:
++ > ++
++ > ++ > /[^a-z0-9]/
++ > ++ >
++ > ++ > But that disallowes A-Z and accented letters as well. Perhaps
++ > ++ > you want /\W/.
++ > ++
++ > ++ Huh?
++ > ++
++ > ++ print join "\n", grep /^[^a-z0-9]/, qw(apple Brown betty Delight);
++ > ++
++ > ++ Does that not print "Brown\nDelight" on your box?
++ >
++ [Snip]
++
++ Not in perl 5.004_04. What version are you using?
Yes, I messed this up.
++ > Your point being?
++
++ That you seemed to be saying that the regex [^a-z0-9] "disallows A-Z",
++ whereas my program demonstrated otherwise. I was hoping that I'd
++ misunderstood you. What's going on here?
The purpose was to catch words containing non-alphanums. Your solution
1) Only checks the first letter of a word.
2) Finds "Brown" and "Delight". Hence, it *dis*allows words
with capital letters. You clearly demonstrated that "Brown"
and "apple" are not in the same category.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Mon, 20 Jul 1998 17:26:04 GMT
From: John Porter <jdporter@min.net>
Subject: Re: A simple question about sub routines
Message-Id: <35B37F2F.7D91@min.net>
Tom Christiansen wrote:
>
> In comp.lang.perl.misc, Chris Wareham <chris.wareham@blackwell.co.uk> writes:
> :The interpreter parses and compiles all the code in your program prior to
> :running it.
>
> Why do people keep saying this? Don't you know a compiler
> from an interpeter? Sheesh. :-(
>
> The compiler compiles and provides the result to a backend,
> like the interpreter or code generator.
A semantic quibble.
Is it incorrect to say that /usr/bin/perl is an interpreter?
(Or rather *the* interpreter :-)
--
John Porter
------------------------------
Date: Mon, 20 Jul 1998 17:27:09 GMT
From: John Porter <jdporter@min.net>
Subject: Re: A simple question about sub routines
Message-Id: <35B37F70.13F4@min.net>
Chris Wareham wrote:
>
> The fact that Perl is a `scripting' langauge still implies ``interpreted'' to
> the more primitive part of my brain.
Oh please. Would you call Lisp a "scripting" language?
--
John Porter
------------------------------
Date: Mon, 20 Jul 1998 10:16:04 GMT
From: "Joseph June" <jjune@midway.uchicago.edu>
Subject: Array element translation
Message-Id: <01bdb3c7$8b31c340$a5128780@joe>
Hi,
A quick question for the experts... any help would be greatly appreciated..
I have an array with numbers from 0 - 3. I want to create another array
from the previous array... with a conversion... all of previous 0s should
be 3s and 1s should be 2s.. so
How can I convert
012121 to 321212
I've tried
(@seq = @comp) =~ tr/0123/3210/
but doesn't seem to work..
any ideas anyone?
JJ
------------------------------
Date: Mon, 20 Jul 1998 16:28:27 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Array element translation
Message-Id: <8c67gsxza6.fsf@gadget.cscaper.com>
>>>>> "Joseph" == Joseph June <jjune@midway.uchicago.edu> writes:
Joseph> I've tried
Joseph> (@seq = @comp) =~ tr/0123/3210/
Joseph> but doesn't seem to work..
@comp = qw( 1 3 3 2 0 1 2 3 );
for (@seq = @comp) { $_ = 3 - $_; }
print "comp = @comp seq = @seq\n";
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 20 Jul 1998 11:26:26 -0600
From: "Kirk D. Haines" <khaines@oshconsulting.com>
To: Joseph June <jjune@midway.uchicago.edu>
Subject: Re: Array element translation
Message-Id: <6ovudv$pq9$1@news-1.news.gte.net>
Joseph June wrote:
[Reply also emailed to JJ]
> I have an array with numbers from 0 - 3. I want to create another array
> from the previous array... with a conversion... all of previous 0s should
> be 3s and 1s should be 2s.. so
>
> How can I convert
>
> 012121 to 321212
>
> I've tried
>
> (@seq = @comp) =~ tr/0123/3210/
>
> but doesn't seem to work..
@seq = grep {tr/0123/3210/} @comp;
Kirk Haines
------------------------------
Date: Mon, 20 Jul 1998 10:45:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Array element translation
Message-Id: <MPG.101d2229e89ced79989770@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc; copy mailed to Kirk D. Haines
<khaines@oshconsulting.com>.]
In article <6ovudv$pq9$1@news-1.news.gte.net> on Mon, 20 Jul 1998
11:26:26 -0600, Kirk D. Haines <khaines@oshconsulting.com> says...
> Joseph June wrote:
> > I have an array with numbers from 0 - 3. I want to create another array
> > from the previous array... with a conversion... all of previous 0s should
> > be 3s and 1s should be 2s.. so
> >
> > How can I convert
> >
> > 012121 to 321212
> >
> > I've tried
> >
> > (@seq = @comp) =~ tr/0123/3210/
> >
> > but doesn't seem to work..
>
> @seq = grep {tr/0123/3210/} @comp;
Wrong. That changes @comp, which is clearly not desired. It also loses
any element that happens not to have a 0 1 2 or 3 in it.
@seq = map { local $_ = $_; tr/0123/3210/; $_ } @comp;
Randal's solution, which is computational instead of by mapping, is
neat(er?).
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 20 Jul 1998 18:24:38 GMT
From: ali@genet.sickkids.on.ca (Alex Dong Li)
Subject: CGI: how to force Netscape to show results line by line?
Message-Id: <6ovnb4$947$1@resunix.sickkids.on.ca>
Hello, CGI experts,
I have written a CGI script to run another, big script.
This big script will print out some message to the web client during the
process. My question is: how to force Netscape to show the results line by
line, instead of showing the whole results at the end of big script
processing?
For the following simple example, the netscape will not show anything until
10 seconds later, when the program ends (I want Netscape to print out
counters one by one, during script processing):
print &PrintHeader;
print "<html><body>\n";
for ($count=0; $count<10; $count++) {
print "$count\n";
sleep (1);
}
print "</body></html>\n";
Regards,
Alex
------------------------------
Date: 20 Jul 1998 15:05:54 GMT
From: snowhare@devilbunnies.org (Snowhare)
Subject: Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. print)
Message-Id: <6ovmci$nq3$1@supernews.com>
Nothing above this line is part of the signed message.
In article <x7sok1m7ai.fsf_-_@sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>
>1. Who is main the PERSON you should think about while you are writing code?
Main is a little man living on a trawler ported in Nova Scotia.
Quite famous programming circles (not so famous in programming
rhomboids).
>2. Other than comments, what is the most important HUMAN aspect of code?
Its voice. The best code has a sexy contralto voice.
>3. What is the main PURPOSE of comments?
Humor.
>Bonus: What is the OPPOSITE of spaghetti code?
Sushi code.
Benjamin Franz
Version: 2.6.2
iQCVAwUBNbNjCejpikN3V52xAQFZdAP8CSkeUp8S0slH1U5PJHPpU9NY7guSSzf/
qm+COjgowXwF82qVdUczqwN7QLTInuZmrvM2EPGlbFizNt77pqNlnGgZLAzDwVNF
jAtGLvR83BUcG3FHzIWs5QhFvb+zROmI0LNgb8kNBjNYuejTJVHvchj/U+oslJt0
xV/UZv0/CSE=
=xvap
-----END PGP SIGNATURE-----
------------------------------
Date: 20 Jul 1998 12:43:10 -0400
From: zyuan@hercules.acsu.buffalo.edu (Zheng Yuan)
Subject: comp.lang.perl.moderate
Message-Id: <6ovs2u$g38$1@hercules.acsu.buffalo.edu>
I am using a perl script to manage a large text file/database. Every time
I need to change one entry (one line) in the file, I have to open the file
and read each line out and write it into another file directly if it is
not the line I want to change. At the end, I rename the new file to my
original file.
This process seems to take a very long time if my data file is really big.
I wonder if anyone out there knows a more efficient way to handle this
matter? I tried to split the file at the line I want to change, using unix
system call, but the command "head", "tail", "split", etc can not be
excecuted in the perl script. And I don't like to use too many system call
anyways.
I would appreciate it if anyone can give me a hand here.
Thanks,
Jenn
------------------------------
Date: Mon, 20 Jul 1998 06:57:02 -0700
From: Paul <swoboda@uvic.ca>
Subject: Re: Lex for Perl / Object Dumper?
Message-Id: <35B34CAE.C84F56D5@uvic.ca>
Matthew O. Persico wrote:
> I always assumed that the only thing that could parse Perl was Perl
> itelf.
>
> And of course, Larry.
Probably ultimately true, although it actually wasn't Perl I was trying to
parse. I finally ended up writing a Perl-generating lex (written in Perl)
on Saturday night out of frustration. It reads a broken sort of flex-like
syntax and supports only inclusive start conditions, and the generated code
isn't exactly as efficient as it could be, but it isn't an object-generator
and it beats hand-hacking yylex()... I added a macro so you can make it
construct tokens as references to 3-element lists, consisting of line#,
char# and the token text (returning $WHATEVER_TOKEN). Not an efficient use
of space, but RAM is a dollar a meg and this is great for error reporting
during abstract-syntax analysis and interpretation.
PS
.
------------------------------
Date: Mon, 20 Jul 1998 10:07:45 -0400
From: "Jonathan B. Joseph" <josepj00@molbio.sbphrd.com>
Subject: mod_perl on RedHat 5.1
Message-Id: <35B34F31.F9F7EB4A@molbio.sbphrd.com>
How can I determine whether mod_perl is really running on the apache web
server (for RedHat Linux 5.1) ?
I have RedHat 5.1 Linux and want to run mod_perl on the Apache web
server. When I listed the apache modules via the command 'httpd -l', I
didn't see mod_perl listed. However, I did see the file mod_perl.so in
the /usr/lib/apache directory. So I thought that perhaps apache was
configured to run mod_perl.
I uncommented an entry in the srm.conf apache configuration file:
Add Alias /home/httpd/perl/ /perl/
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
I placed a cgi module in the /home/httpd/perl directory and it seemed to
run okay. It also ran a little differently, since it displayed on the
web page, the 'Content-type: text/html' statement I always have to put
in my cgi. But did the perl program run under mod_perl or run as a
regular cgi program ?
So the bottom line is that I think that I mod_perl was configured to run
on apache on the RedHat 5.1 installation.
Can anyone help me determine more conclusively on whether or not I'm
really running mod_perl ? Or am I really running the perl program
under CGI control ?
Thanks for any help,
Jonathan Joseph
---------------
jon.joseph@jbjnet.com
------------------------------
Date: Mon, 20 Jul 1998 15:55:56 GMT
From: lindali@my-dejanews.com
Subject: need help: open file for write
Message-Id: <6ovpac$sip$1@nnrp1.dejanews.com>
i've consulted all the faqs and the camel book several times
and it seems that my code is _supposed_ to be working.
however, it's not, so any help from anyone would be appreciated!
i'm trying to open 5 files for my script to write the output
of the data being processed. at the command line, i am typing the
following:
prompt% es_prod.pl es071798.lst
so, es071798.lst is the dataset file being inputted.
the output file names must correspond to the input filename,
i.e. i want 5 files: es0717_h.txt, es0717_f.txt, es0717_m.txt,
es0717_1.txt, es0717_2.txt
here is a portion of my code:
$our_file = $ARGV[0]; # isolate inputted dataset filename
$esMMDD = substr($our_file, 0, 6); # grab the first 6 characters
open ( ESH, ">$esMMDD_h.txt" ) || die "Can't create h file: $!\n";
open ( ESF, ">$esMMDD_f.txt" ) || die "Can't create f file: $!\n";
open ( ESM, ">$esMMDD_m.txt" ) || die "Can't create m file: $!\n";
open ( ES1, ">$esMMDD_1.txt" ) || die "Can't create 1 file: $!\n";
open ( ES2, ">$esMMDD_2.txt" ) || die "Can't create 2 file: $!\n";
# Begin parsing the input file
while(<>) {
...
print ESH " The stuff i want to print to the h file";
print ESF " The stuff i want to print to the f file";
print ESM " The stuff i want to print to the m file";
print ES1 " The stuff i want to print to the 1 file";
print ES2 " The stuff i want to print to the 2 file";
...
}
------------------------------------------------------------
after the script is done running, none of the 5 output files
are present in the current directory.
instead, the only text file there is
.txt
which contains
" The stuff i want to print to the 2 file "
why is this happening? is it because i am trying to use
interpolation to create the filenames?
thanks in advance for your time...
hope somebody has an answer.
- linda
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 20 Jul 1998 11:35:46 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: need help: open file for write
Message-Id: <35B371E2.424706F0@gpu.srv.ualberta.ca>
lindali@my-dejanews.com wrote:
!
! i've consulted all the faqs and the camel book several times
! and it seems that my code is _supposed_ to be working.
! however, it's not, so any help from anyone would be appreciated!
[snip]
! here is a portion of my code:
no -w here, that would have given you a hint as to the
problem:
!
! $our_file = $ARGV[0]; # isolate inputted dataset filename
!
! $esMMDD = substr($our_file, 0, 6); # grab the first 6 characters
!
! open ( ESH, ">$esMMDD_h.txt" ) || die "Can't create h file: $!\n";
! open ( ESF, ">$esMMDD_f.txt" ) || die "Can't create f file: $!\n";
[snip]
you'll want to delimit the variable names in those statements:
open(ESH, ">${esMMDD}_h.txt")||die "can't $!";
otherwise, perl assumes you are trying to use a variable
named $esMMDD_h ... using -w would have told you that.
regards
andrew
------------------------------
Date: Mon, 20 Jul 1998 09:51:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: need help: open file for write
Message-Id: <MPG.101d1585ba8f5ac798976f@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc; copy mailed to lindali@my-dejanews.com.]
In article <6ovpac$sip$1@nnrp1.dejanews.com> on Mon, 20 Jul 1998 15:55:56
GMT, lindali@my-dejanews.com says...
...
> $esMMDD = substr($our_file, 0, 6); # grab the first 6 characters
>
> open ( ESH, ">$esMMDD_h.txt" ) || die "Can't create h file: $!\n";
...
> instead, the only text file there is
> .txt
> which contains
> " The stuff i want to print to the 2 file "
>
> why is this happening? is it because i am trying to use
> interpolation to create the filenames?
Yes, but you are using it incorrectly. In the line above, you are
interpolating the value of '$esMMMD_h', which is undefined (as the '-w'
flag would have told you very plainly).
Use ${esMMDD}_h etc., and all will be well.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 20 Jul 1998 17:19:43 GMT
From: John Porter <jdporter@min.net>
Subject: Re: novice Q; reading columns of numbers
Message-Id: <35B37DB0.C6B@min.net>
isifuelo@my-dejanews.com wrote:
>
> I'm trying to match...
> (\d(\d)?)/(\d(\d)?)/(\d\(d)?)\s([0-9]+(\.[0-9]*)?)\s([0-9]+(\.[0-9]*)?)\s([0-
> 9]+(\.[0-9]*)?)\s([0-9]+(\.[0-9]*)?)\s([0-9]*)
Oh, that's hideous. You surely don't want to do that.
> i dont know how to do last
> column (number with commas) is that right? what other stuff i need to make it
> a perl program (using perl on win95).
Well, do delete commas in a string, you can do this:
$n = '3,242,645';
$n =~ s/,//g;
Here's a for loop which uses a "Schwartzian Transform" to
sort the lines by date. All the other stuff is done
in the second map. My example gets the data lines from
the __DATA__ block, but you can get them from anywhere.
for (
map {
$_->[1]
}
sort {
$a->[0] <=> $b->[0]
}
map {
chomp;
my( $A, $B, $C, $D, $E, $F ) = split;
my( $mon, $day, $year ) = split /\//, $A;
my $date = sprintf("%d%02d%02d", $year, $mon, $day );
$F =~ s/,//g;
[ $date, [ $A, $C, $D, $E, $B, $F ] ]
} <DATA>
) {
local $" = ",";
print "@$_\n";
}
__DATA__
1/05/98 25.545 25.875 26.225 25.323 2,790,245
1/02/98 25.000 25.375 25.750 25.063 2,566,445
12/31/97 25.225 24.938 25.545 24.625 3,242,645
--
John Porter
------------------------------
Date: Mon, 20 Jul 1998 17:20:47 GMT
From: John Porter <jdporter@min.net>
Subject: Re: novice Q; reading columns of numbers
Message-Id: <35B37DF2.6939@min.net>
Ronald J Kimball wrote:
>
> If you use split, watch out for the lines with initial whitespace.
Except that if you split on the special string " " (or ' '), it
strips off leading whitespace for you. (i.e. DWIM.)
--
John Porter
------------------------------
Date: Mon, 20 Jul 1998 16:39:17 GMT
From: John Porter <jdporter@min.net>
Subject: Re: OOP : Object Oriented PROBLEMS!
Message-Id: <35B37438.462E@min.net>
Clinton Gormley wrote:
>
> I'm trying to build methods that allow me to save hashes in an
> SDBM_File database. My TIEHASH method creates a new SDBM_File and stores
> the object in Info (the name of my package). FETCH and STORE convert
> between hashes and strings and either save or fetch the data. All well and
> good.
>[...]
> Does anybody have any suggestions, or sobriques?
Yes: start with something simpler.
And if you want something grueling to cut your teeth on, pick
something that hasn't already been done, well, so that when
you're finished, you'll have something worth contributing to CPAN.
--
John Porter
------------------------------
Date: 20 Jul 1998 16:31:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ovrcj$dld$2@client3.news.psi.net>
Russ Allbery (rra@stanford.edu) wrote on MDCCLXXXIV September MCMXCIII in
<URL: news:m3n2a4r9df.fsf@windlord.Stanford.EDU>:
++ Tom Christiansen <tchrist@mox.perl.com> writes:
++
++ > DB<1> print 1.1.1.1
++ > 1.11.1
++ > DB<2> print 1.1.1.1 + 0
++ > 1.11
++
++ That's... um... weird.
Not if you realize `.' is an operator.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: 20 Jul 1998 13:19:34 -0400
From: zyuan@joxer.acsu.buffalo.edu (Zheng Yuan)
Subject: perl file manipulation --help
Message-Id: <6ovu76$n7j$1@joxer.acsu.buffalo.edu>
I am using a perl script to manage a large text file/database. Every time
I need to change one entry (one line) in the file, I have to open the file
and read each line out and write it into another file directly if it is
not the line I want to change. At the end, I rename the new file to my
original file.
This process seems to take a very long time if my data file is really big.
I wonder if anyone out there knows a more efficient way to handle this
matter? I tried to split the file at the line I want to change, using unix
system call, but the command "head", "tail", "split", etc can not be
excecuted in the perl script. And I don't like to use too many system call
anyways.
I would appreciate it if anyone can give me a hand here.
Thanks,
Jenn
------------------------------
Date: 20 Jul 1998 14:49:13 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Perl for kids
Message-Id: <6ovld9$lq4$4@info.uah.edu>
In article <6ot7dq$8om$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
: You're right that instilling the algorithmic, problem-solving mentality
: early is key here, and that low-level B&D languages just get in the way of
: that. There'll be pain enough in the future. Start with something fun.
Wasn't Smalltalk designed for this purpose? I don't remember Smalltalk
being a very fun language in which to program. :-)
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 20 Jul 1998 16:45:50 GMT
From: michael@rmta.org (Michael Stevens)
Subject: Re: perl4/perl5 differences
Message-Id: <slrn6r6t1r.4eb.michael@lily.csv.warwick.ac.uk>
On 20 Jul 1998 15:06:29 GMT, Michael Stevens <michael@rmta.org> wrote:
<snip problem with differences between perl4 and perl5>
I haven't resolved the problem, but I have found a list of differences at:
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/perl425.html
Is there any other information available?
--
"The world is complex. Sendmail.cf reflects this...."
-- Robbie Honerkamp
--
"The world is complex. Sendmail.cf reflects this...."
-- Robbie Honerkamp
------------------------------
Date: Mon, 20 Jul 1998 08:40:14 -0700
From: Paul <swoboda@uvic.ca>
Subject: Re: Print LoL-tree routine (attached)
Message-Id: <35B364DE.4F0D750A@uvic.ca>
>> Are you just proud of your brainchild?
>> If so, then kudos. KUTGW.
>>
>> --
>> John Porter
One could not possibly be proud of such an ill-conceived and inefficient
abomination of coding; I merely wondered if someone might want it for
printing LoL-trees. There were a few posts about parse-trees a while
back.
PS
.
------------------------------
Date: 20 Jul 1998 16:22:05 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Program to give day of the week from given date
Message-Id: <900952312.387013@thrush.omix.com>
WedgeX@my-dejanews.com wrote:
>snip<
: I too have wondered about computing the day of the week, but I noticed
: something. These examples using time() as the input only computes today's day
: of the week. Does perl have the equivilent of mktime() to compute the number
: of seconds since 1970 for arbitrary dates, so I can then pass into these
: examples?
perldoc Time::Local
Also checkout the Date::Calc and Date::Manip modules at CPAN.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 20 Jul 1998 12:02:23 -0500
From: MrNobody <dunna001@bama.ua.edu>
Subject: PS1 update from a background script
Message-Id: <Pine.GSO.3.96.980720115512.230A-100000@bama.ua.edu>
I am writing a notify program, and the interface that I am trying to get
is one that will drop into the background, and then alter the user's
prompt as needed. I do NOT want to write a command shell.
the problem is thus, how do i do the equivalent of:
>PS1="foo bar baz bat bamf
>$"
from inside a program running background but tied to the correct terminal?
I know that this is not an environment variable issue, but what is is? Is
it possible? Any help is much appreciated.
-MrNobody
I dont exist, so
stop looking at me.
perl -e 'print pack("C*",10,rs(231266),&v,32,rs(17528),rs(235297),&v,32,
rs(195292),&v,32,rs(19496),rs(27979),10);sub v{rand(26)+97};
sub rs{srand($_[0]);(&v,&v,&v);}'
------------------------------
Date: Mon, 20 Jul 1998 11:12:16 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Regex: operand could be empty
Message-Id: <35B36C60.B47E913@gpu.srv.ualberta.ca>
dan@nospam.org wrote:
>
> Hi,
>
> I'm string to read in a text file, and split it into paragraphs - i.e.
> text separated by one or more blank lines.
>
> Here's a quick test program I wrote:
>
> #!/usr/local/bin/perl
>
> #
> # Test of splitting input file by one or more blank lines
> #
>
> $i=0; @para=();
> undef $/; # so files are read in as one string
[snip]
> Can anyone tell me the correct regex I should use?
rather than reading in the whole file and splitting it,
why not just set $/ to "" as described in the perlvar
manpage and read in one 'paragraph' at a time?
regards
andrew
------------------------------
Date: Mon, 20 Jul 1998 09:43:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regex: operand could be empty
Message-Id: <MPG.101d13918a7a60de98976e@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc; copy mailed to Andrew Johnson
<ajohnson@gpu.srv.ualberta.ca>.]
In article <35B36C60.B47E913@gpu.srv.ualberta.ca> on Mon, 20 Jul 1998
11:12:16 -0500, Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> says...
...
> rather than reading in the whole file and splitting it,
> why not just set $/ to "" as described in the perlvar
> manpage and read in one 'paragraph' at a time?
Surely you mean "\n\n".
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 20 Jul 1998 16:38:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: sort function (CGI-Perl)
Message-Id: <6ovrqp$dld$3@client3.news.psi.net>
miedo (431854@cienz.unizar.es) wrote on MDCCLXXXIV September MCMXCIII in
<URL: news:35B31E33.5B04DDAA@cienz.unizar.es>:
++ How i can use the sort function to introduce a series of strings by
++ alphabethical order in a file?
Even CGI "programmers" can read the manual.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Mon, 20 Jul 1998 17:05:35 +0100
From: Matt Pryor <matt@whiterabbit.co.uk>
To: delta <delta@netpage.tm.fr>
Subject: Re: subscript on numeric
Message-Id: <35B36ACF.6FC7176C@whiterabbit.co.uk>
Three major problems, Delta:
1) The error message is created because you've used two sets of quotes,
for some bizarre reason, in your <option value=> tags. Just change it
to
"\t<option value=\"#ffffff\"";
or even:
"\t<option value='#ffffff'";
2) Having corrected this, you will notice more nasty diagnostic
messages. Why? Your using a numeric comparison (==) instead of a
string comparison (eq) on both occassions.
3) Your layout is appalling!
Below is a slightly tidier version of the main problem area:
print "\t<option value=\"#ffffff\"";
if ($fond1 eq "#ffffff" ) {
print "selected";
}
print ">Blanc";
print "\t<option value=\"#000000\"";
if ($fond1 eq "#000000" ) {
print "selected";
}
print ">Noir";
Note: (not a Perl issue but while we're on the subject) it isn't
necessary to close <OPTION> tags in HTML.
Hope this helps,
Matt
delta wrote:
>
> Hello,
>
> There is a part a my script
> **********************************************
> FIN
> $fond1=shift @info;
> print "\t<option value=\""#ffffff"\"";
> if ($fond1 == "#ffffff" ) { print "selected" };
> print ">Blanc</option>";
> print "\t<option value=\""#000000"\"";
> if ($fond1 == "#000000" ) { print "selected" };
> print ">Noir</option>";
> $couleur1=shift @info;
> print << "FIN";
> </select>
> ***************************************
> It's seems to be ok but I get an error message :
>
> Can't use subscript on numeric eq at identdepotan.cgi line 768, near
> ""selected"
> }"
>
> Any idea, .....I have no one
>
> Thank's
--
Matt Pryor
http://www.whiterabbit.co.uk/cgi/cartoons.txt
------------------------------
Date: Mon, 20 Jul 1998 16:45:24 GMT
From: John Porter <jdporter@min.net>
Subject: Re: using get quicker
Message-Id: <35B375A2.30D5@min.net>
joe wrote:
>
> Hey Guys (and just to be diplomatically correct - Hey Gals - even if the
> plural is always masculine) ;-)
How about "Hey, y'all"?
> Currently I need to "get" (as in the method GET) aprox. 1500 URLs per hour.
> My server doesnt like this to much, because its performance goes down
> drastically. (it is a RedHat Linux P II 400 Mhz with eight 155 megabit
> connections to major backbones in the US)
>
> The question is does anyone know of a way for me to "get" these urls in a
> shorter amount of time and how to "get" them in such a fashion, that one
> doesnt notice anything when one trys to access the sites on my server.
As you said, it's the server which doesn't like being stressed,
so speeding things up on the client isn't likely to give much
relief. You need a way to speed up the serving of pages on the server.
How are you currently doing it? CGI? CGI is slow.
Switch to apache + mod_perl.
--
John Porter
------------------------------
Date: Mon, 20 Jul 1998 17:49:21 +0100
From: Richard Proctor <Richard@waveney.demon.co.uk>
Subject: Wierd behaviour of .. operator
Message-Id: <ant201621868Rr9i@waveney.demon.co.uk>
Hi,
(Ok I am new to posting here, but have lurked for months and used Perl for a
year or so, so not a newbie).
I was writing a quick program and wrote:
foreach('A1'..'A13') ...
And had expected the loop to operate with A1, A2, A3, A4, A5, A6, A7, A8, A9,
A10, A11, A12 and A13. BUT was rather surprised to find it generate A1..A9,
then B0..B9 ... Z9 then continue with AA0..AA9 ... ZZ0..ZZ9! Thus
generating 7019 values rather than the 13 I had expected (it never did
generate A10 .. A13). 'A1'..'A9' behaves as expected.
Now when I realised what had happend, I trivially corrected the problem,
however could somebody explain why it did this? Is it a bug? Should
it generate a warning? (I did use -w before you ask)
Richard Proctor
--
$_=join'',map chop,qw(j u unless reset : _ warn do unshift push else for :
pop ne or local : each _ getc fork die for);y~:_~ a~;s%j|p| h%uc$&%eg;print
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3205
**************************************