[10281] in Perl-Users-Digest
Perl-Users Digest, Issue: 3874 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 2 13:07:22 1998
Date: Fri, 2 Oct 98 10:00:20 -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 Fri, 2 Oct 1998 Volume: 8 Number: 3874
Today's topics:
$/ in 5.005 <ets@egnetz.uebemc.siemens.de>
Re: $/ in 5.005 (David A. Black)
Re: Alternate colors in tables with perl command? (Larry Rosler)
Re: Alternate colors in tables with perl command? <keithmur@mindspring.com>
Re: Alternate colors in tables with perl command? <erhmiru@erh.ericsson.se>
Re: Alternate colors in tables with perl command? <jdporter@min.net>
Benchmark: ST vs OM <jdporter@min.net>
Re: Benchmark: ST vs OM <jdporter@min.net>
Re: byte in perl <jdf@pobox.com>
Re: byte in perl (Brand Hilton)
Re: Clarification of $_ please <jdporter@min.net>
Re: Clarification of $_ please <Patrick.Hayes.CAP_GEMINI@renault.fr>
Re: Difference between =~ and =* operators? <jdporter@min.net>
Re: eq on if statement causing problems with string (Brand Hilton)
Re: eq on if statement causing problems with string <jdporter@min.net>
FAQ: Daylightsavings problem <patrick@arch.ethz.ch>
Re: I have installed Linux. Now what? <eashton@bbnplanet.com>
Installing Win32::Internet 0.08 module problem <info@edoc.co.za>
Messages I never read (Andy Lester)
Re: need a 10 milsec delay <michel.prevost@cactuscom.ca_REMOVE_TO_MAIL>
Re: Passing variable from form to form <keithmur@mindspring.com>
per <Ian_Lowe@fanniemae.com>
Re: per <eashton@bbnplanet.com>
Re: string from array (David A. Black)
Re: string from array (Larry Wall)
what does |& do in system() (or in sh) ? <dwatanab@uci.edu>
Re: What is HFB? <eashton@bbnplanet.com>
Re: What is HFB? <jdporter@min.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 02 Oct 1998 18:14:40 +0200
From: "Hr. Jochen Stenzel" <ets@egnetz.uebemc.siemens.de>
Subject: $/ in 5.005
Message-Id: <3614FBF0.D8665A6D@egnetz.uebemc.siemens.de>
Hello,
did the behaviour of $? changed between release 5.00[34] and 5.005? I
read perldelta, but found nothing relating the different behaviour of
the following simple script
BEGIN {print "A\n" if defined $/;}
print "B\n" if defined $/;
which prints A and B in 5.00[34], but only "B" in 5.005. Is $/
initialized later in 5.005?
Thanks in advance
Jochen
------------------------------
Date: Fri, 2 Oct 1998 12:48:18 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: $/ in 5.005
Message-Id: <6v304i$4m6$1@earth.superlink.net>
Hello -
"Hr. Jochen Stenzel" <ets@egnetz.uebemc.siemens.de> writes:
>Hello,
>did the behaviour of $? changed between release 5.00[34] and 5.005? I
>read perldelta, but found nothing relating the different behaviour of
>the following simple script
>BEGIN {print "A\n" if defined $/;}
>print "B\n" if defined $/;
>which prints A and B in 5.00[34], but only "B" in 5.005. Is $/
>initialized later in 5.005?
I can't duplicate your result:
orpheus:~/perl$ perl5.00404
BEGIN {print "A\n" if defined $/;}
print "B\n" if defined $/;
A
B
orpheus:~/perl$ perl5.00502
BEGIN {print "A\n" if defined $/;}
print "B\n" if defined $/;
A
B
David Black
dblack@saturn.superlink.net
------------------------------
Date: Fri, 2 Oct 1998 08:51:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <MPG.107e964d56cc5b76989896@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <3614ED11.D41B8075@min.net> on Fri, 02 Oct 1998 11:11:13 -
0400, John Porter <jdporter@min.net> says...
> Ronald J Kimball wrote:
...
> #!/usr/local/bin/perl
> use Benchmark;
> timethese( 1_000_000, {
> 'using_bang' => ' $toggle = !$toggle ',
> 'using_not' => ' $toggle = not $toggle ',
> 'using_xor' => ' $toggle ^= 1 ',
> });
>
> using_bang: 16.98
> using_not: 11.42
> using_xor: 11.95
What environment was this? My mileage varied considerably.
perl 5.004 on HP-UX 10.20 HP 9000/819:
control: 2.32 # $toggle = $toggle
using_bang: 5.09
using_not: 5.19
using_xor: 3.49
perl 5.005_02 on Windows 95 HP Omnibook 800CT:
control: 1.81 # $toggle = $toggle
using_bang: 4.39
using_not: 5.22
using_xor: 1.05
When I try again on this architecture, replacing your single-quoted
strings by sub { }, I get different results but the same conclusion:
null: 8.30 # sub { }
control: 9.28 # sub { $toggle = $toggle }
using_bang: 11.69
using_not: 11.81
using_xor: 10.98
I find all these results less surprising than yours, which seem
anomalous. I hope someone can shed light (instead of just data) on this.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 02 Oct 1998 11:00:56 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <3614F8B8.1A863118@mindspring.com>
To get further offtopic, I wonder if anyone's ever done a touchpad with
different styli that correspond to different-colored crayons? Thomas
would love that, I bet. If you get rich off this idea, I expect
acknowledgment that I'm an absolute f***ing genius...
Andrew Johnson wrote:
>
> Abigail wrote:
> ! Daniel Pray (daniel@intecomp.com) wrote on MDCCCLV September MCMXCIII in
> ! <URL:news:daniel-2809982259380001@usr10-dialup43.mix1.sacramento.cw.net>:
> ! ++ I've seen some professional web site that have a perl script list a
> ! ++ database request. The table is alternated rows of color. Does anyone know
> ! ++ how to do this?
> !
> ! I would use crayons.
>
> hmm:
> use Crayons;
> nope, maybe its a pragma:
> use crayons;
> nope...
>
> Perhaps you've a custom Crayola interface that works with Perl?
> Please let us know...
>
> I've got one named Thomas, but it doesn't interface with Perl yet,
> and while it is tireless (relentless even), the output is often
> whimsical and unpredictable ... which, of course, would be working as
> documented, if it came with documentation, but they never do :-0
>
> regards
> andrew
------------------------------
Date: 02 Oct 1998 17:44:57 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <lar9wrotmu.fsf@erh.ericsson.se>
John Porter <jdporter@min.net> writes:
[...]
> I guess I'm just in a benchmarking mood these days.
>
> #!/usr/local/bin/perl
> use Benchmark;
> timethese( 1_000_000, {
> 'using_bang' => ' $toggle = !$toggle ',
> 'using_not' => ' $toggle = not $toggle ',
> 'using_xor' => ' $toggle ^= 1 ',
> });
>
> using_bang: 16.98
> using_not: 11.42
> using_xor: 11.95
Here are my results:
SunOS 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-Enterprise
using_bang: 3 secs ( 1.86 usr 0.00 sys = 1.86 cpu)
using_not: 2 secs ( 1.76 usr 0.00 sys = 1.76 cpu)
using_xor: 1 secs ( 1.71 usr 0.00 sys = 1.71 cpu)
SunOS 5.5.1 Generic sun4m sparc SUNW,SPARCstation-4
using_bang: 4 secs ( 4.61 usr 0.00 sys = 4.61 cpu)
using_not: 5 secs ( 4.38 usr 0.00 sys = 4.38 cpu)
using_xor: 6 secs ( 5.60 usr 0.00 sys = 5.60 cpu)
and ;-):
Windows 95. [Version 4.00.950]
Benchmark: timing 1000000 iterations of using_bang, using_not, using_xor...
using_bang: 13 wallclock secs (13.96 usr + 0.00 sys = 13.96 CPU)
using_not: 15 wallclock secs (15.22 usr + 0.00 sys = 15.22 CPU)
using_xor: 6 wallclock secs ( 6.49 usr + 0.00 sys = 6.49 CPU)
On the Ultra Sparc the winner is 'xor' but it is a looser on SPARCstation
where the winner is 'not' which is a looser on Pentium, where the winner
is 'xor' which is the looser ....
Sumarizing:
bang : no wins, one loose.
not : one win, one loose.
xor : two win, one loose.
Therefore, it is not 100% clear for me which is the best.
Note that 'xor' performs remarkly better on Intel architecture.
But conclusion... I dont dare to take any.
>
> Just thought someone might be interested...
>
I was.
> --
> John "Many Jars" Porter
> baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: Fri, 02 Oct 1998 12:38:42 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <36150192.D3706945@min.net>
Larry Rosler wrote:
>
> John Porter <jdporter@min.net> says...
> > using_bang: 16.98
> > using_not: 11.42
> > using_xor: 11.95
>
> What environment was this? My mileage varied considerably.
SunOS 5.4 generic sun4m sparc
perl 5.004_04
> When I try again on this architecture, replacing your single-quoted
> strings by sub { }, I get different results but the same conclusion:
Yes; I don't think any additional insight is be gained by trying
it with subs.
> I find all these results less surprising than yours, which seem
> anomalous. I hope someone can shed light (instead of just data) on this.
Based on yours, my, and Michal's data, the only thing I can think
to say is, YMMV. Xor seems to be the usual winner, but it depends
(on what, who knows). I bet it depends in part on which compiler
was used to generate perl, and which compiler switches (e.g.
optimizations) were in effect.
--
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: Fri, 02 Oct 1998 11:51:16 -0400
From: John Porter <jdporter@min.net>
Subject: Benchmark: ST vs OM
Message-Id: <3614F674.CF723742@min.net>
I've recently been benchmarking the relative performance of
the Schwartzian Transform (ST) (aka. map-sort-map) vs.
the Orcish Maneuver (say "OR-cache").
I recently posted some results that indicate that ST is
more than an order of magnitude slower than OM.
However, those tests were not quite realistic, in that they
discarded the results of the operation. Apparently Perl can
optimize for this, under the right conditions. What follows
is a benchmark wherein the results are not discarded.
#!/usr/local/bin/perl -w
use Benchmark;
# read 3100 7-letter words. shuffle them.
my $file = 'words.7';
open F, $file or die "open $file: $!\n";
my @in = shuffle( <F> ); chomp @in; close F;
my @out;
sub control { # explicit comparison
@out = sort { $a cmp $b } @in
}
sub control0 { # default comparison
@out = sort @in
}
sub ST {
@out =
map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, $_ ] }
@in;
}
sub OM {
my %c = (); # the cache
@out = sort { ($c{$a} ||= $a) cmp ($c{$b} ||= $b) } @in;
}
timethese( 10, {
'ST' => \&ST,
'OM' => \&OM,
'ct' => \&control,
'c0' => \&control0,
} );
sub shuffle { # the usual Fisher-Yates shuffle.
my @i = @_;
for my $i ( reverse ( 0 .. $#i ) ) {
my $j = int( rand( $i ));
@i[$i,$j] = @i[$j,$i];
}
@i;
}
Benchmark: timing 10 iterations of OM, ST, c0, ct...
OM: 33 secs (32.51 usr 0.05 sys = 32.56 cpu)
ST: 30 secs (29.70 usr 0.09 sys = 29.79 cpu)
c0: 2 secs ( 2.52 usr 0.00 sys = 2.52 cpu)
ct: 12 secs (11.48 usr 0.00 sys = 11.48 cpu)
In these tests, I am trying to compare the underlying
algorithms of ST and OM. Therefore, the compare keys
are identical to the original strings, rather than
adding the overhead of computing some other comparison
keys.
Note how using an explicit {$a cmp $b} adds an order
of magnitude overhead. Perl clearly optimizes for
the default sort (the implicit {$a cmp $b}).
--
John "Many Jars" Porter
------------------------------
Date: Fri, 02 Oct 1998 12:42:51 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Benchmark: ST vs OM
Message-Id: <3615028B.6BA57D67@min.net>
John Porter wrote:
>
> Benchmark: timing 10 iterations of OM, ST, c0, ct...
> OM: 33 secs (32.51 usr 0.05 sys = 32.56 cpu)
> ST: 30 secs (29.70 usr 0.09 sys = 29.79 cpu)
> c0: 2 secs ( 2.52 usr 0.00 sys = 2.52 cpu)
> ct: 12 secs (11.48 usr 0.00 sys = 11.48 cpu)
And I forgot to mention:
SunOS 5.4 generic sun4m sparc
perl 5.004_04
--
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: 02 Oct 1998 17:37:21 +0200
From: Jonathan Feinberg <jdf@pobox.com>
To: johnvun@asiapac.net
Subject: Re: byte in perl
Message-Id: <m37lyj561a.fsf@joshua.panix.com>
johnvun <johnvun@asiapac.net> writes:
> i want to know more "Byte" concept in perl. Where i can find more
> information ???
Check out the pack and unpack builtins:
perldoc -f pack
perldoc -f unpack
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 2 Oct 1998 16:04:11 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: byte in perl
Message-Id: <6v2thr$7p22@mercury.adc.com>
In article <36149D3B.A65F817E@asiapac.net>,
johnvun <johnvun@asiapac.net> wrote:
>Hi,
>
>i want to know more "Byte" concept in perl. Where i can find more
>information ???
>For example, i want to send four bytes information to another server
>through socket on NT.
>Below is my message format
>
>Byte Name Value Data Type
>0-1 ID 9000 Short
>2-3 Length 4 Short
>
>Value of 0 to 1 Byte is 9000, value of 2 to 3 byte is 4
>
>so $send_value = "90004" is this right ?
>or $send_value = "9000 4 "
>or $send_value = "9000 4 "
>
>if both values are empty, so is $send_value equal to 36 empty space ????
>
>like this $send_value = " " ????
>
>which one is right ???
Um... none of them. perldoc perlfunc and look for "pack" and "unpack".
For your specific example, you'd probably want to do something like:
$send_value = pack("nn",9000,4);
on the sending end and:
($rcv_1, $rcv_2) = unpack("nn",$rcvd_value);
on the receiving end.
Enjoy.
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Fri, 02 Oct 1998 12:23:35 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Clarification of $_ please
Message-Id: <3614FE07.9A241EF2@min.net>
Patrick Hayes wrote:
>
> What about if you're using 5.005 with threads where $_ and @_ are lexicals?
You tell me.
I haven't used 005.
--
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: 02 Oct 1998 09:34:43 +0200
From: Patrick Hayes <Patrick.Hayes.CAP_GEMINI@renault.fr>
Subject: Re: Clarification of $_ please
Message-Id: <vxjr9wrxvqk.fsf@goblin.pdj.renault.fr>
John Porter <jdporter@min.net> writes:
> Last time, I wrote:
> > my $_ = "hello world!";
>
> Of course, that's not legal perl. Omit the 'my'.
What about if you're using 5.005 with threads where $_ and @_ are lexicals?
Pat
--
----------------------------------------------------------
Patrick.Hayes.CAP_GEMINI@renault.fr (33) 01.41.04.64.20
----------------------------------------------------------
------------------------------
Date: Fri, 02 Oct 1998 12:25:24 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Difference between =~ and =* operators?
Message-Id: <3614FE74.F8482297@min.net>
Erik Huelsmann wrote:
>
> Well, I generally like to torture myself, so I read perlop (in HTML
> format). That is where I found (under s///) that the behaviour of s///
> can be modified by =* (I used =~ until then, but I figured that I was
> doing something wrong..)
Um, are you sure that wasn't $* rather than =* ???
If any perl document mentions a =* operator, it is seriously
hosed.
--
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: 2 Oct 1998 15:56:07 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: eq on if statement causing problems with string
Message-Id: <6v2t2n$7p21@mercury.adc.com>
First off, if 'eq' is returning false, then the two strings aren't
identical. Period. Chances of a version of Perl being released where
'eq' doesn't work are slightly less than nil. So, start with the
assumption that, no matter what they look like when you print them
out, the two strings are not equal, and work from there.
I also gotta whine at you about your code formatting. Makes it real
tough to tell what's going on. In fact, I'm gonna go ahead and format
it properly for you just so I can see what you're doing.
Now, on to the hopefully more helpful stuff :-)
In article <6v267q$23e$1@newsread1-mx.centuryinter.net>,
brettr <brettr@centuryinter.net> wrote:
>I'm using this line if ($password eq $user[1]) to compare the two
>variables. I know both contain the same string, say "hi". If I replace the
>$_ variables with "hi" on both sides of the eq, the if statement will run,
>not the else part.
>
>If I place either $password or $user[1] on both sides of the statement, the
>if part will run and not the else.
>
>However, like the statement is above, the else part runs. I've looked at
>both strings and they are exactly alike. Would the eq be causing some kind
>of problem. The full script is below.
>
>if ($form{'pass'} eq "ok") {
> $passwd="Y";
>}
>else {
> open (PEOPLE, "$users");
Always, ALWAYS, *ALWAYS* check the return code of open.
> while (<PEOPLE>) {
> $row=$_;
> @user = split(/ /,$row);
You probably want split(' ',$row) there. perldoc -f split to find out
what the difference is. If it was me, I'd have skipped the "$row=$_;"
and just written "@user = split;".
> if ($form{'user'} eq $user[0]) {
> $password = crypt($form{'password'}, "MM");
> # space inserted here so $password will be equal to $user[1]. For some
> # reason, $user[1] has a space at the end of it.
BZZT! You just split on spaces, so $user[1] most definitely does NOT
have a space at the end of it. Dunno what it is... maybe a tab... but
it's NOT a space. That's why 'eq' isn't doing what you expect.
> $password = "$password ";
> if ($password eq $user[1]) {
> $passwd="Y";
> }
> else {
> print "<br>password_else = ,$password, user1 = ,$user[1],";
> }
> }
> }
> close (PEOPLE);
>}
HTH
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Fri, 02 Oct 1998 12:11:16 -0400
From: John Porter <jdporter@min.net>
Subject: Re: eq on if statement causing problems with string
Message-Id: <3614FB24.CAB8DFC0@min.net>
I have a lot of suggestions I would like to make for your code,
including a (possible) answer to your question.
0. Always, *Always*, *ALWAYS* check the result of open().
There is never, NEVER a situation in which you can safely
neglect to check the result of open().
1. Did you run this with perl -w? You should.
2. Are you using CGI.pm? I bet not. It would make your life
so much easier, and make your code more robust, and easier
to test. It will change your life.
3. Do you ever format your code? I think it could be better...
4. Use 'my' as often as possible. Avoid globals whenever
possible. Use 'use strict;' to help you learn good coding
habits.
5. chomp each line of input, before you do anything else with it.
(This might solve your problem. Hard to tell, since you
didn't show what the contents of the file look like.)
use CGI;
use CGI::Carp qw(fatalsToBrowser); # for the 'die'.
my $cgi = new CGI;
my $passwd = 'N'; # probably want to initialize this.
if ( $cgi->param('pass') eq 'ok' ) {
$passwd = 'Y';
}
else {
# this is a loop invariant, so I moved it outside the loop:
my $password = crypt( $cgi->param('password'), "MM" );
open PEOPLE, "< $users" or die "open $users: $!";
while (<PEOPLE>) {
chomp;
my( $u, $p ) = split; # split $_ on whitespace.
if ( $cgi->param('user') eq $u ) {
if ( $password eq $p ) {
$passwd = 'Y';
}
else {
print "<br>password_else = '$password' user1 = '$u'";
}
}
}
close PEOPLE;
}
--
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer
------------------------------
Date: Fri, 02 Oct 1998 18:24:00 +0200
From: Patrick Sibenaler <patrick@arch.ethz.ch>
Subject: FAQ: Daylightsavings problem
Message-Id: <3614FE20.41C6@arch.ethz.ch>
Hi,
I'm looking for information about the conversion of seconds to
date and the implementation of daylight saving time. I know
Perl uses the system routines to convert localtime(time).
I happen to have this script that uses seconds as a pointer
to dates:
localtime (909352800) = [1998_10_26_00_00_00]
... very handy, but adding 1 day (84600secs):
localtime (909439200) = [1998_10_26_23_00_00]
instead of the expected [1998_10_27_00_00_00]
... daylight savings switch.
How is this usually solved? I didn't find much in the faq
about it...
greets,
patrick./
ps: please cc to patrick@arch.ethz.ch because I might not be
able to read news in the next days. Thanx!
--
---------------------------------------------------------------------------
The trick is to communicate bi-directional in real time and high
resolution
---------------------------------------------------------------------------
------------------------------
Date: Fri, 02 Oct 1998 15:44:54 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: I have installed Linux. Now what?
Message-Id: <3614F281.7E7B01E4@bbnplanet.com>
Emacs is a bit daunting for the beginner. It is more than an editor, its
a shell, a floor wax and a desert topping! :) I would recommend that you
start with 'vi'. vi is like no editor you will ever use, small,
configureable, and it is always _there_ loyal and waiting to serve. Here
are a few URL's that may help. Also, go out to the bookstore and pick up
a copy of O'Reilly's 'Learning the vi editor' (has a handy cheat sheet)
and 'Learning Perl'. And, of course, have fun learning on a system that,
if you screw it up, a new system is only a boot floppy away. :)
http://www.cs.umr.edu/unixinfo/general/packages/viguide.html
http://www.eng.hawaii.edu/Tutor/vi.html
e.
Would I live my life over again?
Make the same unforgivable mistakes?
Yes, given half a chance. Yes -R. Carver-
------------------------------
Date: Fri, 02 Oct 1998 17:57:05 +0200
From: Nico <info@edoc.co.za>
Subject: Installing Win32::Internet 0.08 module problem
Message-Id: <3614F7D1.3C19@edoc.co.za>
Forgive me if this is a dumb newbie qeustion.
I worked my way up throug trying the standard Perl Functions, and now
want to do more.
I'm running Win95 with Perl5
I tried to install Win32::Internet 0.08
(http://www.divinf.it/dada/perl/)
But get the problem that I have not installed "NT.ph"
Help!!
Thanks
Nico
------------------------------
Date: 2 Oct 1998 16:21:47 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Messages I never read
Message-Id: <6v2uir$f13$1@netnews.mc.net>
For all the novices out there, here are some sure ways to get the more
knowledgeable of us to ignore your message:
* Put "newbie" in the title.
* Ask us "which is better, Perl or [x]", where [x] is something entirely
non-comparable, such as Javascript.
* Ask if there's a bug in Perl, usually in the form of a subject line like
"Bug in Perl?!?!?!?"
* Ask a question that makes it clear that you have done exactly zero
research and reading on your own. Prime example: "Can Perl find a string
in another string?"
* Ask a question that makes it clear that you're pretending to be a
programmer. Prime example: "I'm trying to write an online game. Can Perl
do this?"
Grumpily,
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://www.petdance.com/andy/
Chicago Shows: <shows@chicagomusic.com> http://www.ChicagoMusic.com/
------------------------------
Date: Fri, 02 Oct 1998 12:36:29 -0400
From: Michel Prevost <michel.prevost@cactuscom.ca_REMOVE_TO_MAIL>
To: Doyle Johnson <sales@madm.com>
Subject: Re: need a 10 milsec delay
Message-Id: <3615010D.E9080DA7@cactuscom.ca_REMOVE_TO_MAIL>
Try
select(undef, undef, undef, 0.01);
Michel
Doyle Johnson wrote:
> Hello all,
>
> Since I have been able to get sound advice in here.... I decided to try
> again...
>
> I need to be able to ad a 10 milsec delay into a script before exicuting the
> next line of code. I have looked into sleep but that is in seconds and that
> WAYYY to long. I looked at a few other suggested items and Im not really
> sure whats the best.
>
> Can someone please toss out a bit of code that will invoke a less than 1 sec
> delay?
>
> Thanks
>
> D.Johnson
------------------------------
Date: Fri, 02 Oct 1998 10:50:17 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Passing variable from form to form
Message-Id: <3614F639.B50CB2A0@mindspring.com>
If your question is simply how to pass the name, try something like
this:
<html>
<body>
<form method=POST action="cgi-bin/test.cgi">
Your name:<br>
<input type=text name="name" value="" size=50>
<input type=submit>
</form>
<body>
</html>
The CGI module makes the target script very simple:
use CGI;
$query = new CGI;
print $query->header;
print $query->start_html(-title=>'Test Document');
print "Your name is: " . $query->param('name');
print $query->startform(-method=>'POST', -action=>'test2.cgi');
print $query->hidden(-name=>'name'); #a hidden field, like Reiner
mentioned, automatically POSTed to test2.cgi
print $query->submit;
print $query->endform;
print $query->end_html;
An example of the 2nd target script, test2.cgi, formless in this case:
use CGI;
$query = new CGI;
print $query->header;
print $query->start_html(-title=>'Test Document');
print "Your name is: " . $query->param('name');
print $query->end_html;
I hope this isn't too redundant or obvious, just thought you might like
to see it all done with the CGI module.
gclimb@my-dejanews.com wrote:
>
> I'm trying to learn CGI programming using perl, and I have a question
> regarding forms. I want to build a site that requires multiple forms, and
> wish to have some variables that were defined in one form passed to the next.
> One example would be the persons name...by passing the variable I can use
> their name to address them in each successive form. I've tried my best, but
> can't seem to get it to work. Any help would be appreciated.
>
> Mark
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 02 Oct 1998 11:47:42 -0400
From: Ian Lowe <Ian_Lowe@fanniemae.com>
Subject: per
Message-Id: <3614F59E.8532B36@fanniemae.com>
I have just compiled perl 5.005_02 for the Solaris platform and
everything seems to be working o.k. except for one thing. I have a
couple of scripts that look for filesystem size and capacity, so they
are using `df`. The scripts still operate properly, but they return the
error message : df: cannot statvfs /code: No such file or directory
When I ran make test everything test o.k., but this seems that it could
be a library or header issue? Any ideas?
Thanks for the help.
Ian
------------------------------
Date: Fri, 02 Oct 1998 16:18:52 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: per
Message-Id: <3614FA78.39A32EB0@bbnplanet.com>
Ian Lowe wrote:
> are using `df`. The scripts still operate properly, but they return the
> error message : df: cannot statvfs /code: No such file or directory
> When I ran make test everything test o.k., but this seems that it could
> be a library or header issue? Any ideas?
Well, from the surface of it, df is trying to go at a filesystem /code
which doesn't seem to be there. df can't stat unmounted filesystems.
Have a look at your /etc/vfstab and see if /code is in there. If so,
remount it and i'll betcha it'll work. If not, post the bit of code that
has the system call in it.
e.
Would I live my life over again?
Make the same unforgivable mistakes?
Yes, given half a chance. Yes -R. Carver-
------------------------------
Date: Fri, 2 Oct 1998 12:26:27 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: string from array
Message-Id: <6v2urj$237$1@earth.superlink.net>
Hello -
lr@hpl.hp.com (Larry Rosler) writes:
>[Posted to comp.lang.perl.misc and copy mailed.]
>In article <8cogrve12j.fsf@gadget.cscaper.com> on Fri, 02 Oct 1998
>09:59:50 GMT, Randal Schwartz <merlyn@stonehenge.com> says...
>...
>> Although leaving $" that way will most certainly break larger programs.
>> So, let's try that as:
>>
>> { local $"; $string = "@ary" }
>>
>> and then we have some safety.
>Although leaving $" that way will most certainly cause a warning from '-
>w'. So, let's try that as:
> { local $" = ""; $string = "@ary" }
>and then we have some quiet also.
orpheus:~/perl$ perl -v
This is perl, version 5.005_02 built for i586-linux
[snip]
orpheus:~/perl$ perl -we '{local $"}'
orpheus:~/perl$
Sounds pretty quiet to me :-)
David Black
dblack@saturn.superlink.net
------------------------------
Date: 2 Oct 1998 09:34:54 -0700
From: larry@kiev.wall.org (Larry Wall)
Subject: Re: string from array
Message-Id: <6v2vbe$31j@kiev.wall.org>
In article <MPG.107e6b7b7c3153f4989894@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted to comp.lang.perl.misc and copy mailed.]
>
>In article <8cogrve12j.fsf@gadget.cscaper.com> on Fri, 02 Oct 1998
>09:59:50 GMT, Randal Schwartz <merlyn@stonehenge.com> says...
>...
>> Although leaving $" that way will most certainly break larger programs.
>> So, let's try that as:
>>
>> { local $"; $string = "@ary" }
>>
>> and then we have some safety.
>
>Although leaving $" that way will most certainly cause a warning from '-
>w'. So, let's try that as:
>
> { local $" = ""; $string = "@ary" }
>
>and then we have some quiet also.
Although modifying $" that way will most certainly run a bit slower
than the explicit join, since "@ary" is translated to join($", @ary)
internally.
Larry
------------------------------
Date: Fri, 02 Oct 1998 09:29:58 -0700
From: dana watanabe <dwatanab@uci.edu>
Subject: what does |& do in system() (or in sh) ?
Message-Id: <3614FF4E.73307728@uci.edu>
(excuse the rambling, September was a long month for me, regardless of
the first verse of that children's mnemonic song)
I guess being bourne when or maybe where i was into the world of unix,
i have little experience with just that, so...
I was crawling along in an unemptied sea shell of a way that i'm used to
and i did the following:
open (FIND, "find / -name core -print |& grep -v find: |");
while (<FIND>) {
chomp;
unlink($_);
}
(i know find would do this all nicely for me, but i was doing other
stuff
and i just tend to think in perl first and then try to simplify later)
Running that prints out all the error messages that i was trying to
avoid
having mailed to me (thanks to cron) and then hangs.
I figured out that i really needed to be doing (that is " 2>&1 | " )
thanks to Tim et al 's wonderful 1986 edition of Unix in a Nutshell
BUT... what does |& do?
Playing with it in Bourne, i can't really get a grasp what it does there
and really have no idea what it does when it's in Perl.
------------------------------
Date: Fri, 02 Oct 1998 16:35:28 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: What is HFB?
Message-Id: <3614FE5C.F415B5A2@bbnplanet.com>
Brent Michalski wrote:
> You obviously don't understand men.
What do you mean? I am Elaine _one of the guys_ Ashton here at beautiful
GTEI where I am the only chick among 45 guys. ;) If I understood
everything I would be worried.
> EVERYTHING is /(mis)?construed/ as sexual to us. You could have been
> "Elaine -CardBoardBox- Ashton" and we'd think it was sexual somehow!
There, you've done it. You've killed me and I'm wearing a large portion
of my _very_ hot coffee!
Of course, part of the joke is that if you read that transcript with a
certain perspective it becomes very sexual. I mean, c'mon, Tingling in
the Extremeties? *mwwhaahaa*. I'm twisted and now have less coffee than
I obviously need :P
/me flees
e.
Would I live my life over again?
Make the same unforgivable mistakes?
Yes, given half a chance. Yes -R. Carver-
------------------------------
Date: Fri, 02 Oct 1998 12:18:15 -0400
From: John Porter <jdporter@min.net>
Subject: Re: What is HFB?
Message-Id: <3614FCC7.E2EAC45E@min.net>
Brent Michalski wrote:
>
> "Elaine -C[...]x- Ashton"
Hey, please, watch it with the risque language. Thanks.
--
John "Many Jars" Porter
baby mother hospital scissors creature judgment butcher engineer
------------------------------
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 3874
**************************************