[16525] in Perl-Users-Digest
Perl-Users Digest, Issue: 3937 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 7 14:10:50 2000
Date: Mon, 7 Aug 2000 11:10:30 -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: <965671829-v9-i3937@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 7 Aug 2000 Volume: 9 Number: 3937
Today's topics:
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: New posters to comp.lang.perl.misc <oktay@demokratik.net>
Newbie > MyQL & Perl <((>< <yamar420@my-deja.com>
Re: Newbie > MyQL & Perl (Jon Drukman)
Re: Newbie: Regular Expression (Thorfinn)
Re: Newbie: Regular Expression <aqumsieh@hyperchip.com>
Re: Newbie: Regular Expression <andras@mortgagestats.com>
Re: Newbie: Regular Expression (Tony Balazs)
one liner? <crasssh@my-deja.com>
Re: one liner? (Randal L. Schwartz)
Re: one liner? <Allan@due.net>
Re: one liner? <uri@sysarch.com>
Re: OT: "cute languages" Was: Gee, thanks for all the h (Nobody)
Re: OT: find the number of characters in a string <godzilla@stomp.stomp.tokyo>
Re: OT: find the number of characters in a string <godzilla@stomp.stomp.tokyo>
OT? Parse::RecDescent - comma-list question rocoto@my-deja.com
Re: OT? Parse::RecDescent - comma-list question (Randal L. Schwartz)
Re: OT? Parse::RecDescent - comma-list question rocoto@my-deja.com
Re: passing spaces in URL <mragsdal@utk.edu>
Re: passing spaces in URL <flavell@mail.cern.ch>
Passwords - to crypt() or not to crypt() <daniel@blackomega.com>
Re: Passwords - to crypt() or not to crypt() nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 07 Aug 2000 16:12:59 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <soto0bqn63a7@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 31 Jul 2000 17:16:04 GMT and ending at
07 Aug 2000 16:24:38 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2000 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 247 (45.2% of all posters)
Articles: 466 (24.6% of all articles)
Volume generated: 852.6 kb (25.7% of total volume)
- headers: 371.6 kb (7,440 lines)
- bodies: 475.7 kb (15,747 lines)
- original: 317.3 kb (11,081 lines)
- signatures: 4.9 kb (149 lines)
Original Content Rating: 0.667
Averages
========
Posts per poster: 1.9
median: 1 post
mode: 1 post - 168 posters
s: 2.4 posts
Message size: 1873.4 bytes
- header: 816.5 bytes (16.0 lines)
- body: 1045.2 bytes (33.8 lines)
- original: 697.2 bytes (23.8 lines)
- signature: 10.8 bytes (0.3 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
19 42.4 ( 14.6/ 27.8/ 21.9) Colin Keith <newsgroups@ckeith.clara.net>
18 28.6 ( 10.5/ 18.1/ 13.6) bean <bean@agentkhaki.com>
13 30.1 ( 11.8/ 18.2/ 7.8) Jason Maggard <jmaggard@va.mediaone.net>
12 22.5 ( 10.3/ 12.2/ 7.7) "Troy Rasiah" <troyr@vicnet.net.au>
8 13.1 ( 6.4/ 6.7/ 2.9) bardicstorm@my-deja.com
8 13.1 ( 7.0/ 6.1/ 3.0) "ken" <kensplace@comport.com>
7 7.8 ( 4.8/ 3.0/ 3.0) hugo.b@derivs.com
7 18.3 ( 8.0/ 10.3/ 8.0) "Earthlink News" <rickysregistration@hotmail.com>
6 8.0 ( 4.8/ 3.2/ 3.2) Rashid Saharudin <rashid1218@hotmail.com>
5 11.1 ( 3.8/ 7.3/ 3.4) "Phil Latio" <globalcon2isnot@myhouse.com>
These posters accounted for 5.4% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
42.4 ( 14.6/ 27.8/ 21.9) 19 Colin Keith <newsgroups@ckeith.clara.net>
30.1 ( 11.8/ 18.2/ 7.8) 13 Jason Maggard <jmaggard@va.mediaone.net>
28.6 ( 10.5/ 18.1/ 13.6) 18 bean <bean@agentkhaki.com>
22.5 ( 10.3/ 12.2/ 7.7) 12 "Troy Rasiah" <troyr@vicnet.net.au>
18.3 ( 8.0/ 10.3/ 8.0) 7 "Earthlink News" <rickysregistration@hotmail.com>
15.7 ( 3.6/ 12.0/ 3.1) 5 jthornton@my-deja.com
15.7 ( 2.8/ 12.9/ 9.7) 4 David <brooksd@interlog.com>
14.6 ( 3.7/ 10.9/ 9.7) 4 cawlfiel@uiuc.edu
14.1 ( 3.9/ 10.2/ 4.8) 4 "Chris Stone" <c-stone@att.net>
13.1 ( 7.0/ 6.1/ 3.0) 8 "ken" <kensplace@comport.com>
These posters accounted for 6.5% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 3.0 / 3.0) 7 hugo.b@derivs.com
1.000 ( 3.2 / 3.2) 6 Rashid Saharudin <rashid1218@hotmail.com>
1.000 ( 1.1 / 1.1) 4 "Johannes Stark" <starktdh@gmx.de>
0.990 ( 3.0 / 3.1) 5 "Robert Lee" <robert99@maine.rr.nodamnspam.com>
0.895 ( 9.7 / 10.9) 4 cawlfiel@uiuc.edu
0.895 ( 7.3 / 8.1) 5 tarheel@sierratel.com
0.785 ( 21.9 / 27.8) 19 Colin Keith <newsgroups@ckeith.clara.net>
0.779 ( 8.0 / 10.3) 7 "Earthlink News" <rickysregistration@hotmail.com>
0.777 ( 1.2 / 1.5) 4 Kris Gonzalez <jimjamjoh@softhome.net>
0.753 ( 2.2 / 3.0) 3 zentara <zentara@gypsyfarm.com>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.426 ( 0.5 / 1.2) 4 Martin Mouritzen <martin@fez.dk>
0.411 ( 2.2 / 5.4) 4 Bob Dilworth <bdilworth@mco.edu>
0.370 ( 2.9 / 7.9) 4 Dilworth <dilworth@megsinet.net>
0.338 ( 2.0 / 5.8) 5 "Ryan Tarpine" <rtarpine@hotmail.com>
0.337 ( 1.1 / 3.2) 3 "whitetigercat" <whitetigercat@home.com>
0.335 ( 1.5 / 4.6) 4 "Christopher Thorjussen" <kernel@start.no>
0.324 ( 1.6 / 5.0) 4 Andras Malatinszky <andras@mortgagestats.com>
0.311 ( 1.6 / 5.0) 4 Oktay <john@torontonian.com>
0.307 ( 0.7 / 2.4) 3 Jonathan Kuhn <jonathan.kuhn@gsfc.nasa.gov>
0.259 ( 3.1 / 12.0) 5 jthornton@my-deja.com
41 posters (16%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
37 alt.perl
16 comp.lang.perl.modules
12 comp.lang.perl
9 comp.editors
8 comp.lang.javascript
4 de.comp.lang.perl.cgi
3 comp.lang.java.help
3 alt.comp.perlcgi.freelance
3 it.comp.lang.perl
2 comp.answers
Top 10 Crossposters
===================
Articles Address
-------- -------
7 "Jeffrey R. Bailey" <bailey12@concentric.net>
4 "GS" <pleaseREPLYtotheGROUP@notrealdomain.com>
3 Odious <Odious@home.com>
3 "http://daverwin.homepage.com" <daverwin@hotmail.com>
3 "Jack Thomas" <jthomas@pdxgothic.com>
3 Kris Gonzalez <jimjamjoh@softhome.net>
3 No User <no.user@anon.xg.nu>
2 pking@idirect.com
2 "Scott Snella" <bg229@scn.org>
2 gjm@bigfoot.com
------------------------------
Date: Mon, 07 Aug 2000 16:24:43 GMT
From: "oktay@demokratik.net" <oktay@demokratik.net>
Subject: Re: New posters to comp.lang.perl.misc
Message-Id: <398EE1BC.43B00332@demokratik.net>
Hey!
You can emberras me like that :)
I will post more than 3 tomorrow or may be next week ;)
Anyways, I am an obvious newbie and find this group ver useful.
Best Regards
Oktay
Greg Bacon wrote:
> Following is a summary of articles from new posters spanning a 7 day
> period, beginning at 31 Jul 2000 17:16:04 GMT and ending at
> 07 Aug 2000 16:24:38 GMT.
>
> Notes
> =====
>
> - A line in the body of a post is considered to be original if it
> does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
> - All text after the last cut line (/^-- $/) in the body is
> considered to be the author's signature.
> - The scanner prefers the Reply-To: header over the From: header
> in determining the "real" email address and name.
> - Original Content Rating (OCR) is the ratio of the original content
> volume to the total body volume.
> - Find the News-Scan distribution on the CPAN!
> <URL:http://www.perl.com/CPAN/modules/by-module/News/>
> - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
> - Copyright (c) 2000 Greg Bacon.
> Verbatim copying and redistribution is permitted without royalty;
> alteration is not permitted. Redistribution and/or use for any
> commercial purpose is prohibited.
>
> Totals
> ======
>
> Posters: 247 (45.2% of all posters)
> Articles: 466 (24.6% of all articles)
> Volume generated: 852.6 kb (25.7% of total volume)
> - headers: 371.6 kb (7,440 lines)
> - bodies: 475.7 kb (15,747 lines)
> - original: 317.3 kb (11,081 lines)
> - signatures: 4.9 kb (149 lines)
>
> Original Content Rating: 0.667
>
> Averages
> ========
>
> Posts per poster: 1.9
> median: 1 post
> mode: 1 post - 168 posters
> s: 2.4 posts
> Message size: 1873.4 bytes
> - header: 816.5 bytes (16.0 lines)
> - body: 1045.2 bytes (33.8 lines)
> - original: 697.2 bytes (23.8 lines)
> - signature: 10.8 bytes (0.3 lines)
>
> Top 10 Posters by Number of Posts
> =================================
>
> (kb) (kb) (kb) (kb)
> Posts Volume ( hdr/ body/ orig) Address
> ----- -------------------------- -------
>
> 19 42.4 ( 14.6/ 27.8/ 21.9) Colin Keith <newsgroups@ckeith.clara.net>
> 18 28.6 ( 10.5/ 18.1/ 13.6) bean <bean@agentkhaki.com>
> 13 30.1 ( 11.8/ 18.2/ 7.8) Jason Maggard <jmaggard@va.mediaone.net>
> 12 22.5 ( 10.3/ 12.2/ 7.7) "Troy Rasiah" <troyr@vicnet.net.au>
> 8 13.1 ( 6.4/ 6.7/ 2.9) bardicstorm@my-deja.com
> 8 13.1 ( 7.0/ 6.1/ 3.0) "ken" <kensplace@comport.com>
> 7 7.8 ( 4.8/ 3.0/ 3.0) hugo.b@derivs.com
> 7 18.3 ( 8.0/ 10.3/ 8.0) "Earthlink News" <rickysregistration@hotmail.com>
> 6 8.0 ( 4.8/ 3.2/ 3.2) Rashid Saharudin <rashid1218@hotmail.com>
> 5 11.1 ( 3.8/ 7.3/ 3.4) "Phil Latio" <globalcon2isnot@myhouse.com>
>
> These posters accounted for 5.4% of all articles.
>
> Top 10 Posters by Volume
> ========================
>
> (kb) (kb) (kb) (kb)
> Volume ( hdr/ body/ orig) Posts Address
> -------------------------- ----- -------
>
> 42.4 ( 14.6/ 27.8/ 21.9) 19 Colin Keith <newsgroups@ckeith.clara.net>
> 30.1 ( 11.8/ 18.2/ 7.8) 13 Jason Maggard <jmaggard@va.mediaone.net>
> 28.6 ( 10.5/ 18.1/ 13.6) 18 bean <bean@agentkhaki.com>
> 22.5 ( 10.3/ 12.2/ 7.7) 12 "Troy Rasiah" <troyr@vicnet.net.au>
> 18.3 ( 8.0/ 10.3/ 8.0) 7 "Earthlink News" <rickysregistration@hotmail.com>
> 15.7 ( 3.6/ 12.0/ 3.1) 5 jthornton@my-deja.com
> 15.7 ( 2.8/ 12.9/ 9.7) 4 David <brooksd@interlog.com>
> 14.6 ( 3.7/ 10.9/ 9.7) 4 cawlfiel@uiuc.edu
> 14.1 ( 3.9/ 10.2/ 4.8) 4 "Chris Stone" <c-stone@att.net>
> 13.1 ( 7.0/ 6.1/ 3.0) 8 "ken" <kensplace@comport.com>
>
> These posters accounted for 6.5% of the total volume.
>
> Top 10 Posters by OCR (minimum of three posts)
> ==============================================
>
> (kb) (kb)
> OCR orig / body Posts Address
> ----- -------------- ----- -------
>
> 1.000 ( 3.0 / 3.0) 7 hugo.b@derivs.com
> 1.000 ( 3.2 / 3.2) 6 Rashid Saharudin <rashid1218@hotmail.com>
> 1.000 ( 1.1 / 1.1) 4 "Johannes Stark" <starktdh@gmx.de>
> 0.990 ( 3.0 / 3.1) 5 "Robert Lee" <robert99@maine.rr.nodamnspam.com>
> 0.895 ( 9.7 / 10.9) 4 cawlfiel@uiuc.edu
> 0.895 ( 7.3 / 8.1) 5 tarheel@sierratel.com
> 0.785 ( 21.9 / 27.8) 19 Colin Keith <newsgroups@ckeith.clara.net>
> 0.779 ( 8.0 / 10.3) 7 "Earthlink News" <rickysregistration@hotmail.com>
> 0.777 ( 1.2 / 1.5) 4 Kris Gonzalez <jimjamjoh@softhome.net>
> 0.753 ( 2.2 / 3.0) 3 zentara <zentara@gypsyfarm.com>
>
> Bottom 10 Posters by OCR (minimum of three posts)
> =================================================
>
> (kb) (kb)
> OCR orig / body Posts Address
> ----- -------------- ----- -------
>
> 0.426 ( 0.5 / 1.2) 4 Martin Mouritzen <martin@fez.dk>
> 0.411 ( 2.2 / 5.4) 4 Bob Dilworth <bdilworth@mco.edu>
> 0.370 ( 2.9 / 7.9) 4 Dilworth <dilworth@megsinet.net>
> 0.338 ( 2.0 / 5.8) 5 "Ryan Tarpine" <rtarpine@hotmail.com>
> 0.337 ( 1.1 / 3.2) 3 "whitetigercat" <whitetigercat@home.com>
> 0.335 ( 1.5 / 4.6) 4 "Christopher Thorjussen" <kernel@start.no>
> 0.324 ( 1.6 / 5.0) 4 Andras Malatinszky <andras@mortgagestats.com>
> 0.311 ( 1.6 / 5.0) 4 Oktay <john@torontonian.com>
> 0.307 ( 0.7 / 2.4) 3 Jonathan Kuhn <jonathan.kuhn@gsfc.nasa.gov>
> 0.259 ( 3.1 / 12.0) 5 jthornton@my-deja.com
>
> 41 posters (16%) had at least three posts.
>
> Top 10 Targets for Crossposts
> =============================
>
> Articles Newsgroup
> -------- ---------
>
> 37 alt.perl
> 16 comp.lang.perl.modules
> 12 comp.lang.perl
> 9 comp.editors
> 8 comp.lang.javascript
> 4 de.comp.lang.perl.cgi
> 3 comp.lang.java.help
> 3 alt.comp.perlcgi.freelance
> 3 it.comp.lang.perl
> 2 comp.answers
>
> Top 10 Crossposters
> ===================
>
> Articles Address
> -------- -------
>
> 7 "Jeffrey R. Bailey" <bailey12@concentric.net>
> 4 "GS" <pleaseREPLYtotheGROUP@notrealdomain.com>
> 3 Odious <Odious@home.com>
> 3 "http://daverwin.homepage.com" <daverwin@hotmail.com>
> 3 "Jack Thomas" <jthomas@pdxgothic.com>
> 3 Kris Gonzalez <jimjamjoh@softhome.net>
> 3 No User <no.user@anon.xg.nu>
> 2 pking@idirect.com
> 2 "Scott Snella" <bg229@scn.org>
> 2 gjm@bigfoot.com
------------------------------
Date: Mon, 07 Aug 2000 15:35:37 GMT
From: <((>< <yamar420@my-deja.com>
Subject: Newbie > MyQL & Perl
Message-Id: <8mml09$5sk$1@nnrp1.deja.com>
[ Hello, I have a bit of an issue with Mysql running on Redhat 6.1. I
have ][ installed the
Mysql database and I belive I have installed the perl mods ][ and DBI
mods for it. Below is a
script I have written which should just ][ connect and query. This
might be the issue it self,
since I am very new ][ to writing perl scripts.
So, would this have changed if you were running your script on
FreeBSD, or Solaris. This is
a Perl/MySQL issue, and these areas have their own NG's.
][ #!/usr/bin/perl -w
'-w', good!
][ use Mysql;
use strict; # Good practice.
][ $database-qasrip
][ $dbh = Mysql->Connect
The above two statements are not separated. This will not compile.
';' is the statement
separator.
][ $dbh->SelectDB($database);
][ $sth = $dbh->Query("SELECT * FROM info");
][
][ when I run it I get the errors below, does someone know how to fix
this ][ ?
][
][ ####################################
][ Can't load
][ '/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so'
for ][ module DBD::mysql:
][ /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so:
][ undefined symbol:
uncompress at
][ /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169.
][
][ at /usr/lib/perl5/site_perl/5.005/i386-linux/Mysql.pm line 13 ][
BEGIN failed--compilation
aborted at ./connect2.pl line 3.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 07 Aug 2000 17:56:36 GMT
From: jsd@cluttered.com (Jon Drukman)
Subject: Re: Newbie > MyQL & Perl
Message-Id: <slrn8otu2d.rs5.jsd@cluttered.com>
On Mon, 07 Aug 2000 15:35:37 GMT, <((>< <yamar420@my-deja.com> <> wrote:
> ][ Can't load
> ][ '/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so'
>for ][ module DBD::mysql:
> ][ /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so:
>][ undefined symbol:
> uncompress at
> ][ /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169.
> ][
> ][ at /usr/lib/perl5/site_perl/5.005/i386-linux/Mysql.pm line 13 ][
>BEGIN failed--compilation
> aborted at ./connect2.pl line 3.
this means that you haven't installed the mysql module properly.
as root, do:
perl -MCPAN -e 'install DBD::mysql'
------------------------------
Date: 7 Aug 2000 15:13:21 GMT
From: thorfinn@netizen.com.au (Thorfinn)
Subject: Re: Newbie: Regular Expression
Message-Id: <slrn8otkgh.1ci.thorfinn@netizen.com.au>
In comp.lang.perl.misc, on Mon, 07 Aug 2000 14:15:57 GMT
Tony Balazs <tbalazs-this-must-go@netcomuk.co.uk> wrote:
> $_ = "Tony and Wendy";
> my $count = tr/a-zA-Z0-9//;
> print ($count);
> print ("\n");
> exit;
> gives "12"
> Why does
> my $count = tr/a-zA-Z0-9\s//;
> not give "14"?
> (I want to count the spaces as well as the printing characters).
tr/// is *not* a regular expression related operator.
See 'perldoc perlop'. The LHS is *not* an RE, hence RE special
characters do not work.
Later,
Thorf
--
David Goh <thorfinn@netizen.com.au> --- http://netizen.com.au/
Internet and Open Source Development, Consulting and Training.
Netizen Pty Ltd, GPO Box 2265U, Melbourne VIC 3000, Australia.
Tel: +61 3 9614 0949 Mob: +61 411 692 516 Fax: +61 3 9614 0948
------------------------------
Date: Mon, 07 Aug 2000 15:19:07 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Newbie: Regular Expression
Message-Id: <7aya29cd5g.fsf@merlin.hyperchip.com>
tbalazs-this-must-go@netcomuk.co.uk (Tony Balazs) writes:
> $_ = "Tony and Wendy";
> my $count = tr/a-zA-Z0-9//;
> print ($count);
> print ("\n");
> exit;
>
> gives "12"
> Why does
>
> my $count = tr/a-zA-Z0-9\s//;
>
> not give "14"?
Because tr/// does NOT take a regular expression.
It takes a list of characters. So, your example is searching for
occurrences of a backslash and an 's' (which is already included in
a-z).
What you want is to read about tr/// in perlre.
tr/a-zA-Z0-9 //;
--Ala
------------------------------
Date: Mon, 07 Aug 2000 12:13:09 -0500
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Newbie: Regular Expression
Message-Id: <398EEE25.6D259ABE@mortgagestats.com>
How about just using the length function? You know,
$_="Tony and Wendy";
my $count=length($_);
etc.
Andras
Tony Balazs wrote:
> $_ = "Tony and Wendy";
> my $count = tr/a-zA-Z0-9//;
> print ($count);
> print ("\n");
> exit;
>
> gives "12"
> Why does
>
> my $count = tr/a-zA-Z0-9\s//;
>
> not give "14"?
> (I want to count the spaces as well as the printing characters).
>
> Thanks,
> Tony.
------------------------------
Date: Mon, 07 Aug 2000 16:15:00 GMT
From: tbalazs-this-must-go@netcomuk.co.uk (Tony Balazs)
Subject: Re: Newbie: Regular Expression
Message-Id: <398ee077.11870590@1.0.0.119>
Thank you, all.
Tony.
------------------------------
Date: Mon, 07 Aug 2000 16:00:10 GMT
From: Chris W. <crasssh@my-deja.com>
Subject: one liner?
Message-Id: <8mmme6$778$1@nnrp1.deja.com>
I have lines of (variable length) data containing space-separated
integers. I want to change all but the first five integers in each line
to 0. I can do this by splitting it into an array, as below, but I am
sure there must be some 'neater'/'shorter' way. Any suggestions?
Ta, Chris.
$_ = '1 2 3 4 5 6 7 8 9 10 11 12';
my @cols = split / /;
for my $i (5 .. $#cols) {
$cols[$i] = '0';
}
$_ = join (' ', @cols);
print $_;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 07 Aug 2000 09:19:14 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: one liner?
Message-Id: <m13dkhujr1.fsf@halfdome.holdit.com>
>>>>> "Chris" == Chris W <crasssh@my-deja.com> writes:
Chris> I have lines of (variable length) data containing space-separated
Chris> integers. I want to change all but the first five integers in each line
Chris> to 0. I can do this by splitting it into an array, as below, but I am
Chris> sure there must be some 'neater'/'shorter' way. Any suggestions?
Chris> Ta, Chris.
Chris> $_ = '1 2 3 4 5 6 7 8 9 10 11 12';
Chris> my @cols = split / /;
Chris> for my $i (5 .. $#cols) {
Chris> $cols[$i] = '0';
Chris> }
Chris> $_ = join (' ', @cols);
Chris> print $_;
One line if you futz:
{ my $cnt = 0; s/(\d+)/++$cnt > 5 ? 0 : $1/ge; }
print "Just another Perl hacker,";
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 7 Aug 2000 12:35:36 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: one liner?
Message-Id: <8mmohi$cof$1@slb7.atl.mindspring.net>
"Chris W." <crasssh@my-deja.com> wrote in message
news:8mmme6$778$1@nnrp1.deja.com...
: I have lines of (variable length) data containing space-separated
: integers. I want to change all but the first five integers in each line
: to 0. I can do this by splitting it into an array, as below, but I am
: sure there must be some 'neater'/'shorter' way. Any suggestions?
:
: Ta, Chris.
:
: $_ = '1 2 3 4 5 6 7 8 9 10 11 12';
: my @cols = split / /;
: for my $i (5 .. $#cols) {
: $cols[$i] = '0';
: }
: $_ = join (' ', @cols);
: print $_;
Just a rewrite really.
$_ = join(' ',map{$i++<5?$_:0}split);
but you better reset $i if you are going to do this more than once <g>
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
you can't just guess at things and expect them to work. this isn't sociology.
- brian d foy (in clpm)
------------------------------
Date: Mon, 07 Aug 2000 16:39:07 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: one liner?
Message-Id: <x7n1ip10wm.fsf@home.sysarch.com>
>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
>>>>> "Chris" == Chris W <crasssh@my-deja.com> writes:
Chris> I have lines of (variable length) data containing space-separated
Chris> integers. I want to change all but the first five integers in each line
Chris> to 0. I can do this by splitting it into an array, as below, but I am
Chris> sure there must be some 'neater'/'shorter' way. Any suggestions?
RLS> One line if you futz:
RLS> { my $cnt = 0; s/(\d+)/++$cnt > 5 ? 0 : $1/ge; }
another way:
s{((?:\d+\s+){5})(.*)}{my $s = $2; $s =~ s/\d+/0/g ; "$1$s"}e ;
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 7 Aug 2000 14:51:49 GMT
From: nobody@contract.East.Sun.COM (Nobody)
Subject: Re: OT: "cute languages" Was: Gee, thanks for all the help
Message-Id: <8mmie5$qf2$1@eastnews1.east.sun.com>
In article <slrn8ooh1i.4id.tim@degree.ath.cx>,
Tim Hammerquist <tim@degree.ath.cx> wrote:
>On 05 Aug 2000 13:54:47 GMT, Abigail <abigail@foad.org> wrote:
>> Tim Hammerquist (tim@degree.ath.cx) wrote on MMDXXXI September MCMXCIII
>> in <URL:news:slrn8ont5g.l4.tim@degree.ath.cx>:
>> !! But the only thing in which Java really stands out is that
>> !! it's (AFAIK) the only modern pseudo-interpreted language that supports actual
>> !! data-hiding (private class- and object-properties). If I'm wrong,
>> !! please let me know; I'd like to scope it out.
Ada has had true data-hiding for years, and its current incarnation
(Ada95) supposedly has objects too. Not interpreted, though, except
for ancient prototype compiler versions (Ada/Ed on IBM 3081 mainframe --
wanna talk hideous performance ;-)
Anita
------------------------------
Date: Mon, 07 Aug 2000 09:11:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: OT: find the number of characters in a string
Message-Id: <398EDF9E.D665DF4E@stomp.stomp.tokyo>
Tim Hammerquist wrote:
> Godzilla! wrote:
> > > True, my example would wipe out the letters.
> > > > $letters = $string =~ tr/a-zA-Z/a-zA-Z/;
> > > is correct;
> > pfffttt... you gave a correct answer via
> > paying attention to what you read. Those
> > who don't pay attention while reading, this
> > really REALLY annoys an English teacher.
> Besides...he gets an A for effort, and nevermind he
> was wrong? I thought that would have been particularly
> offensive to a teacher...
His answer isn't wrong. However, you are.
Godzilla!
------------------------------
Date: Mon, 07 Aug 2000 10:13:33 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: OT: find the number of characters in a string
Message-Id: <398EEE3D.2CA9EE63@stomp.stomp.tokyo>
Keith Calvert Ivey wrote:
> tim@degree.ath.cx (Tim Hammerquist) wrote:
> > I think the greatest achievement in this thread was his
> > ability to admit he was wrong and correct himself without
> > bringing anyone down with him. Everyone's allowed to make
> > mistakes; its how someone deals with his own mistakes that
> > shows his character.
> Except that Jim wasn't wrong initially. His mistake was to lose
> confidence in his initial answer (which was right) and change it
> to another (which was also right, but longer).
Precisely.
This is why testing code and, testing differences between
code performing the same task, is very important. Jim certainly
does display a mature attitude reflecting a healthy ego. He
has made no mistake. He has displayed a very healthy mind.
He can only be complimented in all cases.
I suspect Mr. Hammerquist may have some difficulties
displaying an ego as healthy as Jim's own. Doubtful
Mr. Hammerquist will correct his mistake.
As a relatively warm blooded American Woman, it is
my long experience, shorter is often not better.
Godzilla!
------------------------------
Date: Mon, 07 Aug 2000 15:32:12 GMT
From: rocoto@my-deja.com
Subject: OT? Parse::RecDescent - comma-list question
Message-Id: <8mmkpt$5p2$1@nnrp1.deja.com>
Sorry if this is a little off-topic... I was reading about the
Parse::RecDescent module in an earlier discussion here & decided to give
it a try for something I needed.
If you need a parser in perl, I couldn't more highly recommend this....
it's a really fine piece of work - Thanks Damian.....!
Now to the question.... I am trying to parse a list of the form:
item [,item [,item ... ]]
I've successfully used a grammar definition of the form:
ventry:
/apple/i { "APPLE" }
|/pear/i { "PEAR" }
cventry:
',' ventry
velist:
ventry cventry(s?)
{ [@item[1],@{$item[2]}]; }
After seeing the 'new' C grammar posted earlier, I would like to use the
following definition instead ... it seems much cleaner:
ventry:
/apple/i { "APPLE" }
|/pear/i { "PEAR" }
velist:
(ventry ',')(s?) ventry
{ [ ???what goes here??? ]; }
Unfortunately, I seem to be unable to figure out what is in $item[1] for
the latter definition, or how to obtain the definition of the 'ventry'
list it refers to.... All my attempts at dumping $item[1] have resulted
in obtaining a list of ',' characters.... :)
Any help would be appreciated.....
Regards.
--
David
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 07 Aug 2000 09:03:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: OT? Parse::RecDescent - comma-list question
Message-Id: <m1aeepukgs.fsf@halfdome.holdit.com>
>>>>> "rocoto" == rocoto <rocoto@my-deja.com> writes:
rocoto> Now to the question.... I am trying to parse a list of the form:
rocoto> item [,item [,item ... ]]
Then use the "leftop" directive:
The <leftop:...> and <rightop:...> directives provide
an easier way of specifying such operations. Using
<leftop:...> the above examples become:
disjunction: <leftop: conjunction 'or' conjunction>
conjunction: <leftop: atom 'and' atom>
The <leftop:...> directive specifies a left-
associative binary operator. It is specified around
three other grammar elements (typically subrules or
terminals), which match the left operand, the operator
itself, and the right operand respectively.
A <leftop:...> directive such as:
disjunction: <leftop: conjunction 'or' conjunction>
is converted to the following:
disjunction: ( conjunction ('or' conjunction)(s?)
{ $return = [ $item[1], @{$item[2]} ] } )
In other words, a <leftop:...> directive matches the
left operand followed by zero or more repetitions of
both the operator and the right operand. It then
flattens the matched items into an anonymous array
which becomes the (single) value of the entire
<leftop:...> directive.
In your case,
list: <leftop: item ',' item>
which will return an arrayref of all "item"s.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 07 Aug 2000 16:30:01 GMT
From: rocoto@my-deja.com
Subject: Re: OT? Parse::RecDescent - comma-list question
Message-Id: <8mmo62$8df$1@nnrp1.deja.com>
In article <m1aeepukgs.fsf@halfdome.holdit.com>,
merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "rocoto" == rocoto <rocoto@my-deja.com> writes:
>
> rocoto> Now to the question.... I am trying to parse a list of the
form:
> rocoto> item [,item [,item ... ]]
>
> Then use the "leftop" directive:
:
> In your case,
>
> list: <leftop: item ',' item>
>
> which will return an arrayref of all "item"s.
Sooo niiice....
Works great (and now I know a little more too) - Thanks!!
--
David
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 07 Aug 2000 11:47:31 -0500
From: Michael Ragsdale <mragsdal@utk.edu>
Subject: Re: passing spaces in URL
Message-Id: <398EE822.23BC341D@utk.edu>
Jonathan Stowe wrote:
> If that is the case you will be wanting to do more than just URL encode
> the strings - please see the CERT advisory on malicious content.
>
> At the very simplest URL encoding could be :
>
> $string =~ s/([^a-zA-Z0-9])/sprintf "%%%02X",ord($1)/eg;
Thanks for the heads up. I checked out the advisory and will code
accordingly. This is one more reason why I'd prefer to use the POST
method and pass all of my parameters behind the scenes and keep the
actual URL clean and simple. I just haven't figured out yet how to make
a click on a regular <a href> link to do a form "submit" to a .pl script
as would a click on a $q->submit();, which I know is somewhat beyond the
scope of this newsgroup.
-Mike
------------------------------
Date: Mon, 7 Aug 2000 18:04:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: passing spaces in URL
Message-Id: <Pine.GHP.4.21.0008071756180.16865-100000@hpplus03.cern.ch>
On Mon, 7 Aug 2000, Michael Ragsdale wrote:
> Thanks for the heads up. I checked out the advisory and will code
> accordingly. This is one more reason why I'd prefer to use the POST
> method and pass all of my parameters behind the scenes and keep the
> actual URL clean and simple.
If you do the job properly (encoding-wise) then this isn't an issue,
though there are other criteria that might make GET or POST the right
choice according to circumstances. If you don't do the job properly,
then the potential security exposures can be quite subtle, even if
there weren't any browser bugs.
It's much easier, at least till you gain confidence and expertise, to
use CGI.pm. Sure, you still have to do things properly, but it's much
easier to get them right if you aren't hand-knitting each and every
coding and decoding requirement in your own code. And if and when a
security exposure comes to light, and gets fixed in CGI.pm, you just
have to upgrade your library.
By the time one gains the confidence and expertise to do everything
oneself without CGI.pm, one usually discovers one doesn't want to ;-)
> I just haven't figured out yet how to make
> a click on a regular <a href> link to do a form "submit"
It's fundamentally impossible to do a POST that way. GET is discussed
on one of my pages*. But you're in the wrong place for this kind of
discussion. Should be on comp.infosystems.www.authoring.cgi for that
kind of issue.
* http://ppewww.ph.gla.ac.uk/~flavell/www/formgetbyurl.html
good luck
------------------------------
Date: Mon, 7 Aug 2000 12:51:19 +0100
From: "Daniel Foster" <daniel@blackomega.com>
Subject: Passwords - to crypt() or not to crypt()
Message-Id: <8mmj8a$28m$1@newsg3.svr.pol.co.uk>
I couldn't really figure a better place to ask this, and since it
applies to something I'm writing in Perl here goes.
In a CGI web site I'm creating the user logs in with their e-mail
address and password. Their e-mail address and a crypted version of
their password are stored in a MySQL database. I want to implement
the normal 'e-mail me my password since I forgot it' functionality,
but if I crypt the password then clearly I can't get it back.
(crypt() is one-way, right?)
The only solution I can find to this is to store the password
plaintext in the database. Is that the normal way of doing it? More
to the point, is that an acceptable way to do it? And if not, what
would be?
---
You thought the atom was the smallest thing until 50 years ago you
split it open and this whole mess of crap fell out.
- Phoebe (Friends)
Daniel Foster - daniel@blackomega.com
------------------------------
Date: 07 Aug 2000 17:46:55 +0100
From: nobull@mail.com
Subject: Re: Passwords - to crypt() or not to crypt()
Message-Id: <u91z01uigw.fsf@wcl-l.bham.ac.uk>
"Daniel Foster" <daniel@blackomega.com> writes:
> I couldn't really figure a better place to ask this, and since it
> applies to something I'm writing in Perl here goes.
Hmmm.... flamebait. You admit this has nothing to do with Perl.
> I want to implement
> the normal 'e-mail me my password since I forgot it' functionality,
> but if I crypt the password then clearly I can't get it back.
> (crypt() is one-way, right?)
If you want an irreversible cypher you'll have to change that to
'e-mail me a temporary password that I can (only) use to change my
password'. Note the temporary password must not actually replace the
real password as that would permit a DoS attack.
> The only solution I can find to this is to store the password
> plaintext in the database. Is that the normal way of doing it? More
> to the point, is that an acceptable way to do it? And if not, what
> would be?
Acceptable to whom?
Personally I'd use a trvial, reversible obfuscation algorithm so that
I wouldn't accidently learn people's passwords while doing database
maintainance.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3937
**************************************