[11645] in Perl-Users-Digest
Perl-Users Digest, Issue: 5245 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 28 18:03:08 1999
Date: Sun, 28 Mar 99 15:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 28 Mar 1999 Volume: 8 Number: 5245
Today's topics:
Adding an $ENV variable? <mwatkins@promotion4free.com>
Calcultor CGI <jbruhn@skillings.com>
dividing with perl (Mark P.)
Re: dividing with perl <rick.delaney@home.com>
Re: dividing with perl (Mark P.)
Re: dividing with perl (Mark P.)
File backup, or file "clone" with perl <chirstius@mediaone.net>
Re: Help with easy script (Tad McClellan)
Re: Help with easy script <cassell@mail.cor.epa.gov>
Re: perl port for 16-bit MSDOS? <cassell@mail.cor.epa.gov>
Q on procmail piped to perl <tavi367@ibm.net>
Re: Q: opening multiple filehandles concurrently? (Andrew M. Langmead)
Re: RE to match one line of Larry's quote (Tad McClellan)
Spider (Solder182)
Re: Spider (Matthew Bafford)
Re: Split with + , but no %2B <debot@xs4all.nl>
Re: Split with + , but no %2B <Tony.Curtis@vcpc.univie.ac.at>
Re: system ('myproc &'); <tchrist@mox.perl.com>
Re: system ('myproc &'); sstarre@my-dejanews.com
Re: system ('myproc &'); <cassell@mail.cor.epa.gov>
The ONLY reg exp question I will EVER post again! <tripix@tdi-net.freeserve.co.uk>
Re: The ONLY reg exp question I will EVER post again! (Larry Rosler)
Re: The ONLY reg exp question I will EVER post again! <rick.delaney@home.com>
Trying to `tar` in a script ray@marinweb.com
Re: Trying to `tar` in a script <belrick@home.com>
Why do we like Perl? <subbarao@computer.org>
Re: why doesn't this work? <Tony.Curtis@vcpc.univie.ac.at>
Re: why doesn't this work? <ebohlman@netcom.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 28 Mar 1999 23:31:57 +0100
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Adding an $ENV variable?
Message-Id: <OdUdTsWe#GA.316@nih2naaa.prod2.compuserve.com>
Hi there,
I was just wondering, is there anyway to add a variable into the hash %ENV?
What I want to do is what the .htaccess Authentication does, when it adds a
$ENV{'REMOTE_USER'} variable to each person who logs in.
I need the variable to "stick" though, after the script has finished running
its process. It's for a control panel, so when a member logs in, the script
will add his username into the %ENV hash, and that variable will remain
there for everytime the member does something within the panel for that
session.
Any ideas?
Mike
------------------------------
Date: Sun, 28 Mar 1999 10:54:36 -0800
From: "Jason" <jbruhn@skillings.com>
Subject: Calcultor CGI
Message-Id: <922647309.374.78@news.remarQ.com>
Does anyone have a CGI example of a simple Calculator that will use the
input from a web page and run the variables there an equation and post the
answer. If so can you post it here or e-mail me. I want to use it as an
example so I can put some other calculator scripts together. One other
question does it mater what version of perl my service provider is using?
Thanks
Jason
------------------------------
Date: Sun, 28 Mar 1999 20:40:49 GMT
From: mag@imchat.com (Mark P.)
Subject: dividing with perl
Message-Id: <36fe9036.64453208@news.ionet.net>
Can't seem to find any reference to simple division. I just need to
divide two numbers. Very simple but the / character can't be used it
seems. Someone want to enlighten me? Modules aren't an option unless
it comes with the basic Perl binary.
------------------------------
Date: Sun, 28 Mar 1999 21:20:10 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: dividing with perl
Message-Id: <36FE9F05.9D7A6F41@home.com>
[posted & mailed]
Mark P. wrote:
>
> Can't seem to find any reference to simple division. I just need to
> divide two numbers. Very simple but the / character can't be used it
> seems.
Why not? That's the documented division operator. From perlop:
Binary "/" divides two numbers.
Perl's other operators are documented there too.
perldoc perlop
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 28 Mar 1999 21:23:42 GMT
From: mag@imchat.com (Mark P.)
Subject: Re: dividing with perl
Message-Id: <36fe9daa.67897010@news.ionet.net>
Nevermind, I found the answer by searching dejanews.
On Sun, 28 Mar 1999 20:40:49 GMT, mag@imchat.com (Mark P.) wrote:
>Can't seem to find any reference to simple division. I just need to
>divide two numbers. Very simple but the / character can't be used it
>seems. Someone want to enlighten me? Modules aren't an option unless
>it comes with the basic Perl binary.
>
>
------------------------------
Date: Sun, 28 Mar 1999 22:02:34 GMT
From: mag@imchat.com (Mark P.)
Subject: Re: dividing with perl
Message-Id: <36fea6e3.70258536@news.ionet.net>
It was just my crappy code. ':-)
On Sun, 28 Mar 1999 21:20:10 GMT, Rick Delaney <rick.delaney@home.com>
wrote:
>[posted & mailed]
>
>Mark P. wrote:
>>
>> Can't seem to find any reference to simple division. I just need to
>> divide two numbers. Very simple but the / character can't be used it
>> seems.
>
>Why not? That's the documented division operator. From perlop:
>
> Binary "/" divides two numbers.
>
>Perl's other operators are documented there too.
>
>perldoc perlop
>
>--
>Rick Delaney
>rick.delaney@home.com
------------------------------
Date: Sun, 28 Mar 1999 15:17:43 -0600
From: "Chuck Hirstius" <chirstius@mediaone.net>
Subject: File backup, or file "clone" with perl
Message-Id: <20xL2.291$JO4.2930937@rmnws01.ce.mediaone.net>
I currently have written a way through ksh to make disk clones of hard
drives running SCO Unix on servers at work. Where I work we do frequent
regression testing, and need a way to return back to previous "images" on
certain servers. This works fine on a 1 to 1 basis (i.e. cloning one master
to one slave) but I am looking for a way to speed the process and do a "mass
clone" where one drive writes to many. I've looked into ways to do this
under ksh and have not come up with much or every method involves a read for
each write which quickly brings the master drive to it's knees, and started
to look into perl as an alternative. Is there anything built into perl that
can do a read once/write many IO transfer? I am working in a limited memory
space, so I can't read the entire drives contents into memory (they are 9G
drives) is there something that can cache up to the available memory then
dump it out to many Filehandles, or pipes, or whatevers simultaneously? And
then of course repeat the process, until the entire contents have been
transfered. I'll be the first to admit I only know enough about perl to be
dangerous to myself, but I am not opposed to reading docs, so if someone can
just point me in the right direction it would be great, if you have examples
as well, then that's outstanding. Thank you.
Chuck
------------------------------
Date: Sun, 28 Mar 1999 08:45:11 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with easy script
Message-Id: <7pbld7.vm4.ln@magna.metronet.com>
Ophir Marko (ophir@saifun.com) wrote:
: Does anyone have a script that opens a text file, searches it for a line
: in which the string 'x' appears, then copy's the whole line in which the
: string appeared to a new file? I'm having trouble making one, and I'm
: not the worlds most patient person.
perl -ne 'print if /x/' search.file >result.file
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 28 Mar 1999 14:48:58 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Help with easy script
Message-Id: <36FEB1DA.74CAA9BB@mail.cor.epa.gov>
Tad McClellan wrote:
> Ophir Marko (ophir@saifun.com) wrote:
> : Does anyone have a script that opens a text file, searches it for a line
> : in which the string 'x' appears, then copy's the whole line in which the
> : string appeared to a new file? I'm having trouble making one, and I'm
> : not the worlds most patient person.
>
> perl -ne 'print if /x/' search.file >result.file
Of course, if you're not using a version of unix, you'll have to
change the quotes to delimiters your system will recognize. On VMS
or MS-DOS or Win32 platforms, you would want to write this with
double quotes instead of single quotes.
Ahh, the joys of multi-platform interoperability...
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 28 Mar 1999 14:35:00 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: perl port for 16-bit MSDOS?
Message-Id: <36FEAE94.3F17A384@mail.cor.epa.gov>
Hans Olav Husum wrote:
> Please don't laugh: I would like to get hold of a binary dostribution of a
> perl port that runs under MSDOS 3.3 on an 8086. Going back to version 3 or 4
> is OK (and probably necessary).
>
> Can anyone point me in the right direction?
>
> Hans Olav Husum
Believe me, I'm not laughing. Umm, are you sure that you'll be able to
do what you want with such a Perl? Many of the features you might expect
to find in a Perl port would be absent or badly broken.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 28 Mar 1999 13:12:23 -0500
From: "tavi" <tavi367@ibm.net>
Subject: Q on procmail piped to perl
Message-Id: <36fe7085@news1.us.ibm.net>
I want to be able to send inbound e-mail to a Perl script, and this is what
I have done toward that goal.
I am placing this question in both the Perl group and the Procmail mail list
in case someone, in either group, has done this before.
I tried both of these procmail receipts...
:0
* ^TO()perl@tscinternet.com
* HB ?? ? $HOME/vmail/perl/test.pl
| true
:0
* ^TO()perl@tscinternet\.com
| $HOME/vmail/perl/test.pl
Each time, the procmail.log file says...
^@
That's it.
Each time, each receipt, nothing else.
I know the Perl works, because...
- it creates the .out from the prompt
- it creates the .out file with: 'cat my.txt | test.pl'
At least, I think that it means the script works, and is executable.
-rwxrwxr-x 1 walter 393 Mar 25 22:07 test.pl
(The scripts are below)
I even have a shell script that will work...
:0
* ^TO()demo@tscinternet.com
* HB ?? ? $HOME/vmail/perl/demo "`date`"
| true
This works just fine. The shell script creates a .out file containing the
past message.
Anyone have any ideas?
Walter
The scripts...
==========================
#! /usr/local/bin/perl5 -w
$/ = undef; # undefine line terminator
my $message = <STDIN>; # slurp the whole file
$/ = "\n"; # redefine line terminator
open(LOG, ">>./test.out") or die "$0: Unable to open test.out: $!";
print LOG '===============================', "\n";
print LOG $message, "\n\n";
close LOG;
# eof
============================
#!/bin/sh
nl='
'
{ cat; [ -n "$@" ] && echo "$@$nl";} >>$0.out
# EOF
============================
------------------------------
Date: Sun, 28 Mar 1999 18:30:01 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Q: opening multiple filehandles concurrently?
Message-Id: <F9BI22.3Ms@world.std.com>
lr@hpl.hp.com (Larry Rosler) writes:
>In article <1dozudt.1dsb1bg1ppmrnfN@[207.60.170.22]> on Sun, 21 Mar 1999
>02:11:05 -0500, Ronald J Kimball <rjk@linguist.dartmouth.edu >says...
>> Not a new definition. 'couple' can mean 'an indefinite small number' or
>> 'few' in addition to 'two'.
>A new one on me. Fourth definition in my dictionary: 'Informal. A
>few, several: "a couple of days"'. Funny. I always thought that that
>phrase meant "the day after tomorrow". (Every other sense of 'couple'
>in that dictionary is explicitly "two".)
My guess is that the type of people who think "a couple" can only mean
"two" are the type then tend to go into the engineering fields for
their careers.
--
Andrew Langmead
------------------------------
Date: Sun, 28 Mar 1999 08:25:36 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: RE to match one line of Larry's quote
Message-Id: <gkald7.nk4.ln@magna.metronet.com>
Tong (555034897s@acadiau.ca) wrote:
: Larry Rosler wrote:
: >
: > [Posted and a courtesy copy sent.]
: >
: > In article <36FDAAAD.229081CD@acadiau.ca> on Sun, 28 Mar 1999 00:06:05 -
: > 0400, Tong <555034897s@acadiau.ca >says...
:yeah l > Tong wrote:
: > > > I want to sort out all Larry's one line quote. I.e.:
^^^^^^^^ ^^^^^^^^
: > > Sorry I didn't myself clear enough. I mean, can you write a RE to match
: > > *one line* of Larry's quote from "%%" to " -- Larry Wall"? If not, then
^^^^^^^^
: > > any RE that can pick out one line of Larry's quote will do.
: >
: > One such regex would be:
: >
: > /^%%\s+(.*?)\s+-- Larry Wall/ms
: >
: > where the quote proper is captured in $1.
: I used "*one line* of Larry's quote" in order to stress I want only
: those quotes that are, *one line*.
^^^^^^^^
Oh I see (finally).
Now that you have said it three separate times, I believe that
it is true. :-)
I dunno why I misinterpreted what you wanted, seems now that
it should have been clear to me then...
So here's my one-liner:
perl -n0777e 'print "$1\n" while /%%\s+(.*?)\s+-- /g' lwall-q.txt
(I cannot bring myself to use $& ...)
Note my use of while with a m//g option instead of an if,
which would only find a single match in the slurped string.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Mar 1999 21:16:47 GMT
From: solder182@aol.com (Solder182)
Subject: Spider
Message-Id: <19990328161647.24530.00002026@ng-cg1.aol.com>
If anyoen knows where to geta good Spidering Script for free [please let me
know, BUT DO NOT REPLY TO THIS MESSAGE CONATCTS ME ANOTHER WAY
Digital Explorer
ICQ-5989580
AIM-DigitalEx1
http://members.tripod.com/nzhero/
"Knowldege Is Power"
------------------------------
Date: Sun, 28 Mar 1999 22:35:15 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Spider
Message-Id: <slrn7fta7n.3an.dragons@scescape.net>
28 Mar 1999 21:16:47 GMT -- Solder182 <solder182@aol.com>:
-> If anyoen knows where to geta good Spidering Script for free [please let me
-> know, BUT DO NOT REPLY TO THIS MESSAGE CONATCTS ME ANOTHER WAY
IIRC, there is a link at www.perl.com to a Perl web spider. Yep near the
bottom.
Whoops, I guess you won't read this. Too bad.
--Matthew
------------------------------
Date: Sun, 28 Mar 1999 21:14:31 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Split with + , but no %2B
Message-Id: <36FE7F97.A9D55A4A@xs4all.nl>
I know what i've done wrong. You must split a query string with a space
not with a + .
Now all works fine.
$query = Free +Perl Scripts
@array = split (/ /,$query);
$array[0] = Free
$array[1] = +Perl
$array[2] = Script
Frank de Bot wrote:
> Is there anyway to split a string with + while %2B stays ?
> Thanks,
--
My Email : debot@xs4all.nl
Homepages : - http://www.debot.nl/ppi/
- More coming up....
------------------------------
Date: 28 Mar 1999 21:48:36 +0200
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: Split with + , but no %2B
Message-Id: <83bthdjsyz.fsf@vcpc.univie.ac.at>
Re: Split with + , but no %2B, Frank
<debot@xs4all.nl> said:
Frank> I know what i've done wrong. You must split a
Frank> query string with a space not with a + . Now
You cannot have spaces in a QUERY_STRING. That is
precisely why "strange" characters are %-encoded and
so this approach is doomed to failure.
>> Is there anyway to split a string with + while
>> %2B stays ? Thanks,
I'll repeat the previous poster: use CGI.pm and you
don't need to bother with this (or with getting it
wrong :-)
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 28 Mar 1999 11:01:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: system ('myproc &');
Message-Id: <36fe6e72@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, tadmc@metronet.com (Tad McClellan) writes:
: You are not really using functions without reading their
: descriptions, are you?
I'll bet he is. He posted from a Microsoft system, whose denizens are
notorious for their post-literate culture. Sometimes it amazes me that
they can type at all. This thing you call a computer is, after all,
for them merely an appliance, like a toaster or a water hose. They have
no culture of consulting online documentation. They just guess, or beg
the answers from those who can actually read.
Welcome to Bill's World.
--tom
--
"The printing on the t-shirt was not an encrypted message, it was a Perl
script... " (Don Henson, "alt.security.pgp" June 1995)
"You just contradicted yourself there... :-)" (Larry Wall,
"alt.security.pgp" June 1995, answer to Don Henson)
------------------------------
Date: Sun, 28 Mar 1999 22:02:45 GMT
From: sstarre@my-dejanews.com
Subject: Re: system ('myproc &');
Message-Id: <7dm8u1$nah$1@nnrp1.dejanews.com>
I'm not a "he", I did read Camel sections on exec, system, and fork, and I'm
programming on a unix system, and I hate u-soft. Other than those few errors
you've got me pegged!
-------------------------------------------------------------------------
system('myproc); #executes and the calling process waits for it to finish
system('myproc &'); #should start my proc in the bg and return. it doesn't-
instead it behaves just like the first case.
I'll ask it another way - "why do these two calls behave the same?"
-S
In article <36fe6e72@csnews>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, tadmc@metronet.com (Tad McClellan) writes:
> : You are not really using functions without reading their
> : descriptions, are you?
>
> I'll bet he is. He posted from a Microsoft system, whose denizens are
> notorious for their post-literate culture. Sometimes it amazes me that
> they can type at all. This thing you call a computer is, after all,
> for them merely an appliance, like a toaster or a water hose. They have
> no culture of consulting online documentation. They just guess, or beg
> the answers from those who can actually read.
>
> Welcome to Bill's World.
>
> --tom
> --
> "The printing on the t-shirt was not an encrypted message, it was a Perl
> script... " (Don Henson, "alt.security.pgp" June 1995)
> "You just contradicted yourself there... :-)" (Larry Wall,
> "alt.security.pgp" June 1995, answer to Don Henson)
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 28 Mar 1999 14:30:35 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: system ('myproc &');
Message-Id: <36FEAD8B.3D5BF7D6@mail.cor.epa.gov>
Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
> In comp.lang.perl.misc, tadmc@metronet.com (Tad McClellan) writes:
> : You are not really using functions without reading their
> : descriptions, are you?
>
> I'll bet he is. He posted from a Microsoft system, whose denizens are
> notorious for their post-literate culture. Sometimes it amazes me that
> they can type at all. This thing you call a computer is, after all,
> for them merely an appliance, like a toaster or a water hose. They have
> no culture of consulting online documentation. They just guess, or beg
> the answers from those who can actually read.
>
> Welcome to Bill's World.
At least in Wayne's World, they would bow down and say "We're not worthy!
We're not worthy!" :-)
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 28 Mar 1999 19:52:04 +0100
From: "Wayne Keenan" <tripix@tdi-net.freeserve.co.uk>
Subject: The ONLY reg exp question I will EVER post again!
Message-Id: <7dlu49$btc$1@news6.svr.pol.co.uk>
If I promise to never post a Reg expression question again, (I'm of to
learn regexp, any easy start points?)
(my last post , the ASCII < 32 started a snowball)
please could someone tell me how to do this:
a $string containing multiple lines of
[spaces] [number1] [spaces] [number2] [spaces] [number2] [spaces] [number3]
[spaces] [number3][spaces] [number3] [newline]
where :
[spaces] is varying lengths of whitespace
[newline] wont insult.
[number1] is a positive integer (max 6 chars)
[number2] is a +/- integer (max 6 chars)
[number3] is one of: (max 16 chars)
[number]
or [number]@
or -
If I asked to be able to step through the $string line by line, this too
would be handled
by a regexpression I belive.
Many thanks you patient and talented people,
Wayne
------------------------------
Date: Sun, 28 Mar 1999 12:00:45 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: The ONLY reg exp question I will EVER post again!
Message-Id: <MPG.11682a4a2920e62f9897e3@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7dlu49$btc$1@news6.svr.pol.co.uk> on Sun, 28 Mar 1999
19:52:04 +0100, Wayne Keenan <tripix@tdi-net.freeserve.co.uk >says...
...
> a $string containing multiple lines of
> [spaces] [number1] [spaces] [number2] [spaces] [number2] [spaces] [number3]
> [spaces] [number3][spaces] [number3] [newline]
>
> where :
> [spaces] is varying lengths of whitespace
I will assume that you mean here '>= 1 spaces or tabs'.
> [newline] wont insult.
> [number1] is a positive integer (max 6 chars)
> [number2] is a +/- integer (max 6 chars)
> [number3] is one of: (max 16 chars)
> [number]
> or [number]@
> or -
>
> If I asked to be able to step through the $string line by line, this too
> would be handled by a regexpression I belive.
Assuming for simplicity that the string is in $_:
while (/^[ \t]+ # New 'line' plus space
(\d+) # number1 -> $1
[ \t]+ # more space
([+-]\d+) # number2 -> $2
[ \t]+ # more space
([+-]\d+) # number2 -> $3
[ \t]+ # more space
(\[?\d+(?:]\@?)?|-) # number3 -> $4
[ \t]+ # more space
(\[?\d+(?:]\@?)?|-) # number3 -> $5
[ \t]+ # more space
(\[?\d+(?:]\@?)?|-) # number3 -> $6
\n/gmx) { # newline; repeat ad lib
... Do something ...
}
Untested (because you didn't supply any sample data and I'm lazy), but
if it's wrong you'll learn more by fixing it than I will. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 28 Mar 1999 20:06:56 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: The ONLY reg exp question I will EVER post again!
Message-Id: <36FE8DD4.766DE405@home.com>
[posted & mailed]
Wayne Keenan wrote:
>
> If I promise to never post a Reg expression question again, (I'm of
> to learn regexp, any easy start points?)
perldoc perlre
Or if you don't see that as easy, perhaps _Mastering Regular
Expressions_ by Jeffrey Friedl.
> (my last post , the ASCII < 32 started a snowball)
> please could someone tell me how to do this:
>
> a $string containing multiple lines of
> [spaces] [number1] [spaces] [number2] [spaces] [number2] [spaces]
> [number3] [spaces] [number3][spaces] [number3] [newline]
>
> where :
> [spaces] is varying lengths of whitespace
\s+
perldoc perlre
> [newline] wont insult.
^^^^^^
??
\n
perldoc perlre
> [number1] is a positive integer (max 6 chars)
\d {1,6}
Did I mention perlre?
> [number2] is a +/- integer (max 6 chars)
See perlfaq4, "How do I determine whether a scalar is a
number/whole/integer/float?".
> [number3] is one of: (max 16 chars)
^^^^^^
|
> [number]
\d+
> or [number]@
\d+\@
> or -
-
or putting them together:
(\d+|\d+\@|-)
This is not the only way. For instance, you could do
(\d+\@?|-)
where \@? means zero or one '@'. Btw, you don't always need to escape
the @, but it can never hurt.
I am ignoring the maximum of 16 characters requirement. You can often
simplify your pattern matches if you know your data will meet a certain
requirement, which it usually does. Matching one or more digits is
easier to write, and if you know the data will never have more than 16
characers of this then there is no point building that limit into the
regex.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 28 Mar 1999 20:23:49 GMT
From: ray@marinweb.com
Subject: Trying to `tar` in a script
Message-Id: <36fe78fd.5999859@nntp1.ba.best.com>
I'm trying to do this...
`tar -cfz $logDir/oldLogs/$filename.tgz $logDir/dailyLogs/*`;
in a script.
$logDir is something like '/path/to/directory'
My goal is to copy archive all the files in 'dailyLogs' to a file
named '$filename.tgz' in 'oldLogs'
I get this message:
tar: can't add file
/webadmin/home/web1/nbc/public_html/data/oldLogs/199711.tgz
: No such file or directory
What am I doing wrong?
------------------------------
Date: Sun, 28 Mar 1999 20:36:51 GMT
From: Bruce Elrick <belrick@home.com>
Subject: Re: Trying to `tar` in a script
Message-Id: <36FE92E2.D2F3774A@home.com>
Ray...
ray@marinweb.com wrote:
> I'm trying to do this...
>
> `tar -cfz $logDir/oldLogs/$filename.tgz $logDir/dailyLogs/*`;
>
try:
`tar -czf $logDir/oldLogs/$filename.tgz $logDir/dailyLogs/*`;
I think your code was trying to create a tar called 'z'. '-f' requires
a filename right after it...
Cheers...
Bruce
--
Bruce Elrick, Ph.D.
mailto:belrick@home.com
http://members.home.net/belrick/
------------------------------
Date: Sun, 28 Mar 1999 14:22:42 -0500
From: Kartik Subbarao <subbarao@computer.org>
Subject: Why do we like Perl?
Message-Id: <36FE8182.379E0B35@computer.org>
I'd like to get some input from fellow Perl fans on this question.
Having worked with Perl for about 9 years or so, I find that it
continues to be a trusty sidekick, helping me with many programming
tasks. It's more than kept pace as my programming abilities have
improved and my interests have changed, with new features and a wealth
of modules. After all this time, I still find myself learning ever
cooler ways to do things in Perl on a regular basis, a true testament to
its versatility.
But of course, not everyone sees things the way I do. Which prompts the
question I'd like to pose to the community. Why exactly do the fans
among us like Perl? What are the aspects of it that appeal to us in
particularly compelling ways?
One of the angles I want to explore on this is personality theory. Back
before "The Cathedral and the Bazaar", Eric Raymond maintained the
Jargon file, where he noted the following about the personality
characteristics of hackers:
``In terms of Myers-Briggs and equivalent psychometric systems,
hackerdom appears to concentrate the relatively rare INTJ and INTP
types; that is, introverted, intuitive, and thinker types...ENT[JP]
types are also concentrated among hackers but are in a minority.''
An interesting observation, which I think I can expand on. I've got some
preliminary ideas on how Perl might be a particularly natural fit for
some personality types. But I'd like to get some independent data from
people. Those of you who like Perl and are familiar with personality
models like Myers-Briggs or other models, what type describes your
personality best? And do you have any thoughts on aspects of Perl that
particularly appeal to that type?
Thanks for any information or observations that you might have.
-Kartik
--
Email: subbarao@computer.org
WWW: http://www.geocities.com/SiliconValley/Way/1234/
------------------------------
Date: 28 Mar 1999 21:50:39 +0200
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: why doesn't this work?
Message-Id: <83aewxjsvk.fsf@vcpc.univie.ac.at>
Re: why doesn't this work?, Frank
<debot@xs4all.nl> said:
Frank> I think you better use this code instead of
Frank> the library cgi-lib.pl (It's some easier to
Frank> understand):
use CGI; like ths rest of the world!
Frank> ($ENV{'REQUEST_METHOD'} eq "POST") {
Frank> read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } @in
Look mum, a buffer overflow waiting to happen!
use CGI; and everyone is happy...
perldoc CGI
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Sun, 28 Mar 1999 21:08:41 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: why doesn't this work?
Message-Id: <ebohlmanF9BpEH.9pG@netcom.com>
Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
: On Sun, 28 Mar 1999 08:44:48 -0500, Aaron Walker <amwalker@gate.net> wrote:
: >open(FILE, "/home/httpd/cgi-bin/catalog.dat");
: You forgot the || die "Couldn't open catalog.dat : $!" before the semi-colon.
: >@data = <FILE>;
: >close(FILE);
: >
: >open(TEMP, ">/home/httpd/cgi-bin/catalog.dat");
: You forgot the || die "Couldn't open catalog.dat : $!" again...
: Also concurrent execution is going to ruin your whole day. You need some kind
: of locking scheme...
: >foreach $i (@data)
: >{
: > while($i !~ /$del/i)
: > {
: > print TEMP "$i\n";
: > }
: What do you think would happen if there was no match with the regex.
: I thnk you might find the while would loop forever.
And, of course, when the server finally terminates the looping program,
the original data file will already have been wiped out.
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5245
**************************************