[9400] in Perl-Users-Digest
Perl-Users Digest, Issue: 2995 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 26 16:18:33 1998
Date: Fri, 26 Jun 98 13:00:32 -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, 26 Jun 1998 Volume: 8 Number: 2995
Today's topics:
Re: accessing a:\ (M.J.T. Guy)
Camel book examples and -w (Marc Haber)
Re: Can someone explain the arrow operator ? (Matt Knecht)
Re: efficient director watching psj@cgmlarson.com
Re: Flames.... <tchrist@mox.perl.com>
Re: Flames.... (Leslie Mikesell)
Re: Flames.... (Leslie Mikesell)
Re: Flames.... <ajohnson@gpu.srv.ualberta.ca>
growing array size: Is this a bug? (unknown)
Help with Programming (Bruno Pisano)
Help with sorting <gkassyou@newbridge.com>
Re: Hiding the Perl source <tchrist@mox.perl.com>
Re: Hiding the Perl source (I R A Aggie)
how to know the limit of a perl array? (Yongyan Wang)
Re: HTML form and Perl script send data to another Perl (p)
Re: installation on NT <Darrell@Nash.org>
Re: Linked list and a code challenge (Snowhare)
Perl-MPI? <xing@pacific.jpl.nasa.gov>
process lock files? (Marc Haber)
Replacing "stuff" via Regex... HELP! <mcisar@iul.net>
Re: Subroutine Variables <svetleva@cs.purdue.edu>
Re: use of crypt to encrypt password (brian d foy)
want a better way to split string <adegutis@isi-info.com>
Re: want a better way to split string (Sean McAfee)
Re: Y2K Problem <tchrist@mox.perl.com>
Re: Y2K Problem <*@qz.to>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Jun 1998 18:06:45 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: accessing a:\
Message-Id: <6n0nvl$mcs$1@pegasus.csx.cam.ac.uk>
Russ Allbery <rra@stanford.edu> wrote:
>
>use Fatal. It was in Perl core at one point, but had some problems due to
>how prototyping was working and due to the difficulty of overloading some
>built-in operators. I'm not sure of it's eventual fate, although I've
>heard rumors it will be back in 5.005.
Well, it's in perl5.004_68. So keep your fingers crossed.
Mike Guy
------------------------------
Date: Fri, 26 Jun 1998 19:33:48 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Camel book examples and -w
Message-Id: <6n0t40$oji$2@nz12.rz.uni-karlsruhe.de>
Hi!
I am writing a script that calls other programs. The output generated
by these programs is to be redirected to a file. So, I'd have to
re-open stdin and stdout to the file while setting them back to the
original values afterwards.
The camel book example code looks like this:
>mh@palandt:/home/mh/wd2 > cat test.pl
>#!/usr/bin/perl -w
>open(SAVEOUT, ">&STDOUT");
>open(SAVEERR, ">&STDERR");
>
>open(STDOUT, ">foo.out") || die "Can't redirect stdout";
>open(STDERR, ">&STDOUT") || die "Can't dup stdout";
>
>select(STDERR); $| = 1; # make unbuffered
>select(STDOUT); $| = 1; # make unbuffered
>
>print STDOUT "stdout 1\n"; # this works for
>print STDERR "stderr 1\n"; # subprocesses too
>
>close(STDOUT);
>close(STDERR);
>
>open(STDOUT, ">&SAVEOUT");
>open(STDERR, ">&SAVEERR");
>
>print STDOUT "stdout 2\n";
>print STDERR "stderr 2\n";
>mh@palandt:/home/mh/wd2 >
Please note that I added the -w switch to enforce strict checking
which I do as a rule.
>mh@palandt:/home/mh/wd2 > test.pl
>Name "main::SAVEOUT" used only once: possible typo at ././test.pl line 2.
>Name "main::SAVEERR" used only once: possible typo at ././test.pl line 3.
>stdout 2
>stderr 2
>mh@palandt:/home/mh/wd2 >
How do I get rid of these warnings? BTW, I consider them out of place
since SAVEOUT and SAVEERR actually get re-used on the second open()
call sequence.
Any hints will be appreciated.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Fri, 26 Jun 1998 17:59:14 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Can someone explain the arrow operator ?
Message-Id: <SjRk1.104$ja2.1231760@news2.voicenet.com>
Mike Mckinney <mike@bga.com> wrote:
>Thanks for the clear examples you posted, they should be a great help in
>getting over this hurdle. As you said before, I am having trouble with
>references, but from what I can gather from this NG, and what I've read
>on-line, it is recommended to use a reference when possible...
Everybody has their own preferences. For my own, I use references only
when they are the most convienient (Sometimes _only_) way to solve a
problem.
>Note that as far
>as I know this has'nt been stated outright, but from the code and examples
>I've seen, the above appears to hold. So, even with a simple scalar
>assignment, using a reference is preferable, like so ? :
>
>$file = \$cooling if
>
>instead of :
>
>$file = $cooling if
I wouldn't do this. making everything a reference makes about as much
sense as making everything a hash! Use them only when you need to.
Here's an example that uses a very handy reference, and a reference that
you could do without:
#!/usr/local/bin/perl -w
open(FILE, '/home/hex/perl/file') or die "open: $!\n";
my $line = getline(\*FILE);
print "$$line";
sub getline
{
my $file = shift;
my $line = <$file>;
return \$line;
}
__END__
First, the good part about references from this program. The line of
code "$line = getline(\*FILE);" uses a reference to pass the typeglob
(the * notation means a typeglob) of FILE. This is _very_ handy, as
it's the only way you can pass file handles to a subroutine (Without
using a module, which does the same thing internally).
The spurious use of a reference comes in the line: "return \$line".
Code like this is attempting to save some time by only passing the
reference to $line, instead of the line itself. This doesn't save much
time at all, as the bulk of time is spent on accessing the file, not in
the passing of arguments. The only thing you get when doing this is
code that's harder to read.
Don't just use references 'because'. Have a reason for using them.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: 26 Jun 1998 19:08:07 GMT
From: psj@cgmlarson.com
Subject: Re: efficient director watching
Message-Id: <6n0rin$bcv$1@news10.ispnews.com>
Russ Allbery <rra@stanford.edu> wrote:
>> Is File::stat combined with a while/sleep loop going to be the best?
> Pretty much, yeah, unless you're on IRIX.
Well... Irix is one of them, but I'm not going to do platform specific
stuff... Thanks for the help!
Pat
--
Patrick St. Jean '97 XLH 883 psj@cgmlarson.com
Programmer & Systems Administrator +1 713-977-4177 x115
Larson Software Technology http://www.cgmlarson.com
------------------------------
Date: 26 Jun 1998 17:49:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Flames....
Message-Id: <6n0n04$jkv$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
kortbein@iastate.edu (Josh Kortbein) writes:
:Earlier, somewhere, in this thread a big deal was made out of grep-abilty.
:If being able to use grep is so crucial, then shouldn't one attempt to
:make as much data as possible greppable?
We've gone from talking about the basic core documentation to talking
about Joe Schmoe's 3rd party documentation not distribution
with the core. These aren't the same, and shouldn't be. That
doesn't mean that I don't want people using modules, just that
what you're talking about has strayed far from the original issue,
and is not directly applicable.
--tom
--
"It's ironic that you would use a language as large as English to express
so small a thought."
--Larry Wall
------------------------------
Date: 26 Jun 1998 13:47:08 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Flames....
Message-Id: <6n0qbc$3hs$1@Venus.mcs.net>
In article <fl_aggie-2606980929000001@aggie.coaps.fsu.edu>,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
>+ In my earlier post I questioned why CGI related topics were often
>+ roasted as inappropriate for c.l.p.m, yet they are clearly going
>+ to be a large part of the perl conference.
>
>Ummm...because the "perl conference" != "clpm"?
And the difference in the appropriate topics is....?
>because there is a
>seperate newsgroup devoted to all things CGI, and that CGI questions
>stand a much better chance of being answered there where there are
>occasional CGI experts,
The answer to most perl/CGI questions is to use code or examples
that someone else has already done. You aren't going to find
people who know where all the perl code lives over in the
generic CGI/asp/nsapi groups.
>...than here where there are occasional perl
>experts who may or may not understand CGI?
errr.. You seem to have missed the point that these are the
very same experts who are going to devote much of the perl
conference to tutorials on CGI programming. Note that I am
not suggesting that anyone expert or otherwise is ever obligated
in any way to answer any usenet question. However the rude
brush-offs and references to consulting fees and commercial products
are just out of place. I'm convinced that the reason that new
perl users don't read the newsgroup to learn about the common
problems before posting is that it is just too painful.
>If you want to mix-n-match, why not just have _one_ newsgroup.
>James - for all of UseNet, that is...
You need two: one for topics where a perl program is the solution
and a second for everything else. And only a few years ago
you would have found perl advocates in the 2nd group pointing
out the error of their ways.
Les Mikesell
les@mcs.com
------------------------------
Date: 26 Jun 1998 14:08:28 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Flames....
Message-Id: <6n0rjc$3v1$1@Venus.mcs.net>
In article <6n0n04$jkv$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> kortbein@iastate.edu (Josh Kortbein) writes:
>:Earlier, somewhere, in this thread a big deal was made out of grep-abilty.
>:If being able to use grep is so crucial, then shouldn't one attempt to
>:make as much data as possible greppable?
>
>We've gone from talking about the basic core documentation to talking
>about Joe Schmoe's 3rd party documentation not distribution
>with the core. These aren't the same, and shouldn't be.
You lost me here. How/why did the way I should search the documentation
for (say) CPAN.pm change on the day that it was included in the
core distribution? Should I have known about this change?
> That
>doesn't mean that I don't want people using modules, just that
>what you're talking about has strayed far from the original issue,
>and is not directly applicable.
Please elaborate on how documentation should be treated differently
based on its origin or distribution? If you don't know whether
the thing you are looking for exists or not, what steps should
you take to make this distinction? As a real-world example,
I'd like to find a way to store a data structure in shared
memory that any of several perl processes could update or
use for a quick lookup, perhaps using this a cache against
DBI database lookups. Where would you start?
Les Mikesell
les@mcs.com
------------------------------
Date: Fri, 26 Jun 1998 14:09:21 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Flames....
Message-Id: <3593F1E1.390E1978@gpu.srv.ualberta.ca>
Leslie Mikesell wrote:
!
! In article <fl_aggie-2606980929000001@aggie.coaps.fsu.edu>,
! I R A Aggie <fl_aggie@thepentagon.com> wrote:
!
! >+ In my earlier post I questioned why CGI related topics were often
! >+ roasted as inappropriate for c.l.p.m, yet they are clearly going
! >+ to be a large part of the perl conference.
! >
! >Ummm...because the "perl conference" != "clpm"?
!
! And the difference in the appropriate topics is....?
The difference is that clpm is a newsgroup for discussions about
Perl and perl...not about the CGI protocol or CGI programming.
The perl conference is a different forum---it can encompass any
topics and tutorials that the organizing bodies wish, including
various problem and application domains. Just because they've
deemed a topical area as valid for the conference in no way
implies that it is suddenly appropriate for clpm.
regards
andrew
------------------------------
Date: 26 Jun 1998 18:42:28 GMT
From: kesey@globe.ece.utexas.edu (unknown)
Subject: growing array size: Is this a bug?
Message-Id: <KESEY.98Jun26134229@globe.ece.utexas.edu>
I found what I think may be a bug in perl. I wrote this simple
program to demonstrate the situtation:
#!/usr/local/bin/perl5 -w
@arr = (0, 1);
print "0 LAST ELEM $#arr\n";
&someSub ($arr[2]);
print "1 LAST ELEM $#arr\n";
push @newArr, $arr[20];
print "2 LAST ELEM $#arr\n";
&someSub ($arr[5], 3);
print "3 LAST ELEM $#arr\n";
&someSub (3, $arr[9]);
print "4 LAST ELEM $#arr\n";
@newArr = reverse (3, $arr[20]);
print "5 LAST ELEM $#arr\n";
# This causes a segmentation fault.
# @newArr = sort (3, $arr[30]);
# print "6 LAST ELEM $#arr\n";
sub someSub
{
}
__END__
On my system, this generates the output:
0 LAST ELEM 1
1 LAST ELEM 1
2 LAST ELEM 1
3 LAST ELEM 1
4 LAST ELEM 9
5 LAST ELEM 9
The problem is that the size of the list grows due to the function call
&someSub (3, $arr[9]);
I thought that referring to an list element past the end of the list
does not increase the size of the list. Notice that using the same
parameters with the built-in function 'reverse' does not grow the
list. Also, putting the undefined list element first in the parameter
list does not grow the list.
An unrelated problem I found is that the 'sort' using the undefined
list element causes a segmentation fault on my system.
My perl version is
This is perl, version 5.001
Unofficial patchlevel 1m.
-John
------------------------------
Date: 26 Jun 1998 12:04:01 -0700
From: chiherbs@primenet.com (Bruno Pisano)
Subject: Help with Programming
Message-Id: <6n0rb1$83q@nntp02.primenet.com>
I develop web sites, and trying to get into more complex
programming.
Searching through CGI/Perl, ASP and Cold Fusion.
To build sites that need search capabilities and
shopping cart, what would you recommend I learn, which
is the easiest and most practical?
(I bought a book which is supposed to be the best,
called CGI/Perl Cookbook, and I'm having a hard time
even on the very first application...)
Please, reply to
Bruno Pisano
chiherbs@primenet.com
------------------------------
Date: Fri, 26 Jun 1998 15:40:56 -0400
From: George Kassyousef <gkassyou@newbridge.com>
Subject: Help with sorting
Message-Id: <3593F948.735F767@newbridge.com>
This is a multi-part message in MIME format.
--------------2D3A0E977391C06179B550D4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
My perl script reads a file and insert some specific info into several
text variables such as
var1 var2 var3 var4.
var1 is a string that holds a persons name.
var2 is an integer that holds the persons age.
var3 is a string of the persons address.
var4 is an integer of the persons number.
How can I sort on this persons age if I have a list of people.
eg.
jack 23 100 huntly cres. 555-1233
mike 25 200 hunly cres. 555-2332
.
.
.etc.
any help is appreciated.
THX..
--------------2D3A0E977391C06179B550D4
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for George Kassyousef
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: George Kassyousef
n: Kassyousef;George
org: Newbridge Networks
adr: 349 Terry Fox Dr.;;;Kanata;ON;K2K-2E7;Canada
email;internet: gkassyou@newbridge.com
title: OES Systems Engineer
tel;work: 599-3600 x1630
tel;fax: 599-3660
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
end: vcard
--------------2D3A0E977391C06179B550D4--
------------------------------
Date: 26 Jun 1998 17:48:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Hiding the Perl source
Message-Id: <6n0msh$jkv$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
killord@my-dejanews.com writes:
:You want to access yr database- You want
:to set the database user to a certain person and password combo- but without
:anyone seeing it in the script, or where the file is kept. So there is a
:*perfectly* *valid* reason that he may want to hide his script from the
:public- (not to say that there isn't a better method for doing what I
:described, and not to say that Pham was necessarily thinking of this
:however)-
Putting passwords in cleartext is highly bad. In fact, it's
somewhere in the supernutty range. Compiling doesn't
help this. Sheesh. I thought we all knew this?
--tom
--
I'm TRYING to be a back end! - --Andrew Hume
------------------------------
Date: Fri, 26 Jun 1998 14:07:11 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Hiding the Perl source
Message-Id: <fl_aggie-2606981407120001@aggie.coaps.fsu.edu>
In article <6n0ilj$ak2$1@nnrp1.dejanews.com>, killord@my-dejanews.com wrote:
+ So there is a *perfectly* *valid* reason that he may want to hide his script
You mean there "might be a valid reason". Your example, however, is
one of:
Security through obscurity is a terribly dangerous miscarriage of truth.
-- Tom Christiansen
+ - the point is this- AND EVERYONE IN THE NEWSGROUP SHOULD BE
+ LISTENING- Don't judge until the jury's in. Dig?
Well, isn't it up to the original poster to make clear what s/he believes
are her/his valid reasons for obsfucation?
James
------------------------------
Date: 26 Jun 1998 18:50:20 GMT
From: ywang@emma.plaza.ds.adp.com (Yongyan Wang)
Subject: how to know the limit of a perl array?
Message-Id: <6n0qhc$f7j@myst.plaza.ds.adp.com>
In perl, the array can be assigned without pre-assigning its subscript limit,
like $var[100]="value";
How can I know the limit of the subscript of the variable? Practically, can I do the following $var[1000000000000000000000000]="value"; ?
Thanks,
Yongyan
------------------------------
Date: Fri, 26 Jun 1998 19:02:08 GMT
From: xp1r@iname.com (p)
Subject: Re: HTML form and Perl script send data to another Perl script
Message-Id: <35907861.216235@news.danbbs.dk>
>> Remove the 'x' from the email address, if you want to send a
>> non-commercial email.
>
>Remove the 'x' from the email address, if you want to get replies by
>email. :-)
I sounds you are not so hard hit by spammers as I am. Spammers are
stealing emal addresses from USENET, and sending all kinds of junk
email.
The 'x' is just a little protection from those criminals.
Peter
Remove the 'x' from the email address, if you want to send a non-commercial email.
I read unsolicited commerical email for at least US$75 per email.
------------------------------
Date: Fri, 26 Jun 1998 13:00:11 -0600
From: "Darrell Nash" <Darrell@Nash.org>
Subject: Re: installation on NT
Message-Id: <3593efa0.0@news.cadvision.com>
chiahead wrote in message <3593de45.161952004@client.news.psi.net>...
>Using NT4.0 I have installed the perl 5 interpreter, added the
>directory to the path, and can run the following hello world program
>with the expected results.
> .. <<snipped>>
>the file is called "test.pl". It seems it doesn't know this is a perl
>file when I am on the web. How do I make IIS4 realize that this is a
>perl file and needs to be treated as such.
>
>I have file types set up for perl.exe as .pl and .cgi.
>
>Does anybody know where I am messed up? (besides the obvious initial
>responses)
You need to add a registry entry in IIS4 to recognize a .pl or .cgi file as
a Perl executible. You can refer to Chapter 8 in the documention that comes
with it (as web pages), under "Publishing Dynamic Applications". In brief,
here's what you need to do:
1. start "regedit" from a DOS prompt
2. follow this path to find the proper place: HKEY_LOCAL_MACHINE ->
SYSTEM -> CurrentControlSet ->Services -> W3SVC -> Paramenters -> Script Map
3. Add a new String value with a key of ".pl", and a data value of
"C:\PERL\BIN\PERL.EXE %s %s" (or where ever your perl executible is)
That should do it - you may or may not need to restart the WWW service for
it to recognize the change. There may be some easier, hidden way to do this
through a nice GUI, but I haven't found it.
Hope that helps.
--
Darrell Nash
Senior Systems Developer
First International Financial Corporation
nash@freerealtime.com
------------------------------
Date: 26 Jun 1998 19:15:57 GMT
From: snowhare@devilbunnies.org (Snowhare)
Subject: Re: Linked list and a code challenge
Message-Id: <6n0s1d$ka0$1@supernews.com>
Nothing above this line is part of the signed message.
In article <6n0fk9$8d0$1@supernews.com>,
Snowhare <snowhare@devilbunnies.org> wrote:
>Given a finite linked list similiar the one I drew above, determine
>if a *loop* exists in the linked list with the smallest possible
>use of memory (scratch variables) and CPU (in other words the
>lowest order computational complexity). You should return the
>list element where the loop occurs ('b' in the example above) or
>null if no loop is present. The linked list is in the form
>of a hash ($hsh{'1022'} => '3421'; $hsh{'3421'} => '54532';, and
>so on). The loop may be any size up to and including the entire
>linked list or as small as 2 elements linked together at the tail.
A clarifying note: The linked list is finite, but of indeterminate
length. IOW: You don't know in advance how long it is.
Benjamin Franz
Version: 2.6.2
iQCVAwUBNZP45+jpikN3V52xAQEHDwQAjblbJW3kysRTK3sHXNheReBPN87vSWno
3UGGJV8cvWm8EK/7G/lOwEoV6qgp7gFjzDmPYFD5E+rrCGp7iRd/CwBrePeCCjqz
m9l3uzdpQHtJg7QUGjB5an/iDkRhQu5nxMw3+TpoOcjmaqtH9uqj8Qn/+kOc4XtN
0tQegj1G1eQ=
=VO3s
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 26 Jun 1998 11:44:32 -0700
From: Zhangfan XING <xing@pacific.jpl.nasa.gov>
Subject: Perl-MPI?
Message-Id: <3593EC10.2781@pacific.jpl.nasa.gov>
Hi,
I am looking for a perl to MPI interface,
something similar to Perl-PVM.
Any help will be greatly appreciated.
Zhangfan
------------------------------
Date: Fri, 26 Jun 1998 19:33:57 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: process lock files?
Message-Id: <6n0t43$oji$3@nz12.rz.uni-karlsruhe.de>
Hi!
Generally, when running a program that should only have a single
instance running, one uses a lock file that is placed in
/var/lock/programname. The program checks on startup if the lock file
exists and terminates in that case. If the program does not exist, it
creates that file, runs and deletes the lock file on exit. To
gracefully handle crashed programs, I understand that it's common
practice to write the program's pid to the lock file and to verify in
the second instance if a process with that pid does still exist.
This is fairly standard practice and so I suspect that code exists
"out there" to do that. It should no be that hard to write in perl but
before I go out reinventing the wheel I'd like to know if that
particular wheel already exists.
Any hints will be appreciated.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Fri, 26 Jun 1998 13:21:06 -0600
From: Mike Cisar <mcisar@iul.net>
Subject: Replacing "stuff" via Regex... HELP!
Message-Id: <3593F4A1.C8D07792@iul.net>
Appologies if this has been posted before/recently... but I've been
hammering my head up against the wall for hours trying to write a Regex
that will take the input string (a comma delimited line from a
spreadsheet) and remove any fields that are quoted. There may be zero
or more fields which are quoted and must be nuked.
ie. if the input line was
data,data,data,number,text,"string",data, stuff,"nuther",stuff,text,"two
words",text
the output would be
data,data,data,number,text,,data, stuff,,stuff,text,,text
still leaving the commas as the field separator, but removing any and
all fields that are quoted (so in this case we nuke "string" "nuther"
and "two words")
I'm sure this is just a problem of "I've been looking at this too
long"... any help is *GREATLY* appreciated.
Thanks,
>>>>> Mike <<<<<
------------------------------
Date: Fri, 26 Jun 1998 14:42:20 -0500
From: Alex Svetlev <svetleva@cs.purdue.edu>
Subject: Re: Subroutine Variables
Message-Id: <3593F99B.7B375F9@cs.purdue.edu>
Jonathan Feinberg wrote:
> Alex Svetlev <svetlev@vmw3.ibm.com> writes:
>
> > I have a subroutine with variables that I declare with "my". Each time I
> > call this subroutine, the variables still have the values they did in
> > the previous call.
>
> You must be scoping those variables outside of the sub, yes? You must
> use my() inside the scope you're interested in:
>
> sub foo {
> my $bar;
> }
>
> And *NOT*
>
> my $bar;
> sub foo {
> # use $bar
> }
>
> Although that second construction has its uses.
>
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
> http://pobox.com/~jdf/
Unfortunately I'm not. I'm declaring the variable only in the sub with
"my", yet the old $bar is remembered next time I call &foo. That's what's
perplexing me. Any clue?
------------------------------
Date: Fri, 26 Jun 1998 13:24:17 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: use of crypt to encrypt password
Message-Id: <comdog-ya02408000R2606981324170001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6n0dpa$4sl$1@vixen.cso.uiuc.edu>, jhtodd@students.uiuc.edu (jeremy howard todd) posted:
> $encrypted = crypt($password, substr($password, 0, 2));
"truncating the salt to two characters is a waste of CPU time" :)
also, using the password as the salt will give away the first
two characters of the password.
to compare passwords:
$encrypted_guess = crypt($guessed_passwd, $encrypted_passwd);
if( $encrypted_guess eq $encrypted_passwd )
{
...
}
to encrypt a new password:
$encrypted_passwd= crypt($plaintext, $random_salt);
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: Fri, 26 Jun 1998 14:12:43 -0500
From: "Al Degutis" <adegutis@isi-info.com>
Subject: want a better way to split string
Message-Id: <6n0rjs$pgk$1@news.megsinet.net>
(am I a novice or hack: your call)
I'm trying to break down a string to fit 60 characters per line. Rather
than use a specific length of 60 characters, I'd like to break the string on
the nearest space starting from the 50th position.
this is what I'm currently using:
$desc1 = substr($desc,0,60);
$desc2 = substr($desc,61,60);
$desc3 = substr($desc,121,60);
$desc4 = substr($desc,181,60);
------------------------------
Date: Fri, 26 Jun 1998 19:25:57 GMT
From: mcafee@centipede.rs.itd.umich.edu (Sean McAfee)
Subject: Re: want a better way to split string
Message-Id: <9BSk1.1357$24.7524217@news.itd.umich.edu>
In article <6n0rjs$pgk$1@news.megsinet.net>,
Al Degutis <adegutis@isi-info.com> wrote:
>I'm trying to break down a string to fit 60 characters per line. Rather
>than use a specific length of 60 characters, I'd like to break the string on
>the nearest space starting from the 50th position.
I'm sure there's a module on CPAN that does this, but for something quick
and dirty, how about:
$line =~ s/(.{50}.{0,10}) /$1\n/g;
Any tab characters in $line may cause the line to be displayed over more
than 60 screen columns.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 26 Jun 1998 17:58:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Y2K Problem
Message-Id: <6n0nga$jkv$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
carltipton@mail.kmsp.com (Carl Tipton) writes:
:I have noticed a great number of unqualified opinions and
:recommendations on the Y2K issue. As an IT professional,
Do you mean a data processing person? It doesn't mean
computer scientist.
Here's another statement: perl has no y2k problem. Repeat that reading
until you understand it.
But you might have a y2k. And you can't fix it, because it's in the
wetware, not the software. I've written a lot about this already.
See www.perl.com about it.
--tom
--
"My philosophy of life is that the meek shall inherit
nothing but debasement, frustration, and ignoble deaths..." - Harlan Ellison
------------------------------
Date: 26 Jun 1998 18:41:57 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Y2K Problem
Message-Id: <eli$9806261439@qz.little-neck.ny.us>
In comp.lang.perl.misc, Carl Tipton <carltipton@mail.kmsp.com> wrote:
> blah blah blah blah Can someone direct me to resources that address
> this issue from an IT professional's perspective? blah blah blah
Be concise!
:r! nntplist -x comp.*2000
comp.software.year-2000 0000067554 0000064201 y
Elijah
------
betcha dejanews could have helped you a lot in this quest
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 2995
**************************************